Level1

Navigation Commands in Selenium | To() | back() | forward() | refresh()

Navigation Commands in Selenium | To() | back() | forward() | refresh()

Level1, Selenium
Navigation Commands : Navigation commands are used to navigate from one web page to another web page, Navigation commands also helps to navigate through browser history like back forth or to refresh the current page.   To() : If you wants to navigate on specific web application page or URL in between your software test then you can use driver.navigate().to('url") command . driver.navigate().to("http://google.com/"); Back(): We can go back to previous page with driver.navigate().back() command. driver.navigate().back(); Forward(): We can go forward from current page to last opened page with driver.navigate().next() command, but for using forward() method, you must have navigated back first. driver.navigate().forward(); Refresh(): We can refresh
Open Browser in Selenium

Open Browser in Selenium

Automation, Level1, Selenium
Opening a browser with binary File: There will be situations, where you have to test your web application against two different versions of the  browser. For example consider FireFox, By default, when you create object to FirefoxDriver, the Firefox version that is available on the PATH variable is launched. But if you want to launch a different version of Firefox, we need to use Firefox Binary, or if the browser is not in the standard PATH then you should specify the browser binary file location to open the browser. public static void main(String[] args) { File pathToBinary = new File("C:\\PATH\\App\\Firefox\\firefox.exe"); FirefoxBinary firefoxBinary = new FirefoxBinary(pathToBinary); FirefoxProfile firefoxProfile = new FirefoxProfile(); WebDriver driver = new Firefo
WebElement Actions

WebElement Actions

Automation, Level1, Selenium
In this selenium tutorial , we will learn all the different user actions that can be performed on an WebElement. Different WebElements will have different actions that can be taken on them. For example, in a textbar element, we can type in some text or clear the text that is already typed in it. Similarly for a button, we can click on it, get the dimensions of it, and position of it on the webpage, but we cannot type into a button, and for a link, we cannot type into it. All the actions are present as method in WebElement interface in selenium webdriver. In case we try to execute a wrong action on a WebElement, we don’t see any exception or error thrown and also we don’t see any action that really gets executed; WebDriver ignores such actions. The getAttribute() method The ge

What should be automated ?

Automation, Level1, Selenium
It's bee traditional thinking to... One to one mapping between manual tests and automated tests. Trying to have as much requirements and test case coverage as possible. Automated tests should be able be reproducible manually. But over the years, I've found that having 1000's of test cases I tend to cause even more problems. 1. Test code is harder to maintain which becomes production code. Besides the technical aspects like having to bend over backwards to accommodate changes in the software under test, it is also the lack of support from business and development for test code. For example, very few shops will hold up a release or delay development if there are broken tests or flaky tests.  The default is generally to comment those tests out..
Basic Selenium Commands

Basic Selenium Commands

Level1, Selenium
Get Command get() command is use to open a new web page in the current browser. Command: driver.get(“URL”); Example : driver.get("http://google.com");   Get Title Command getTitle() command is use to get the title of the current page. Example : driver.getTitle();   Get Current URL Command getCurrentUrl() command is use to get the URL of the page currently loaded in the browser. Example : driver.getCurrentUrl()   Close Command close() command is use to close the current window of the browser, if it’s the last window it will close the browser. Example : driver.close();   Quit Command quit() command is use to quit the browser and all the opened windows in the browser. Example : driver.quit();   Get Page Source Command