21⟩ Tell me could cookies be deleted in Selenium?
driver.manage().deleteAllCookies(); //command is used for deleting all cookies
“Automation related Frequently Asked Questions by expert members with professional career as Automation. These list of interview questions and answers will help you strengthen your technical skills, prepare for the new job interview and quickly revise your concepts”
driver.manage().deleteAllCookies(); //command is used for deleting all cookies
Selenium lets to perform different kinds of keyboard operations, such as:
☛ .pressKey("non-text keys") is used for keys like control, function keys etc that are non-text
☛ .releaseKey("non-text keys") is used in conjunction with key press event to simulate releasing a key from keyboard event
☛ .sendKeys("sequence of characters") is used for passing character sequence to an input or textbox element.
linkText() and partialLinkText() are used for link location.
The examples:
WebElement link1 = driver.findElement(By.linkText(“some_link_test”));
WebElement link2 = driver.findElement(By.partialLinkText(“some_link_part_text”));
Some commonly and popularly used methods of Robot Class during web automation:
keyPress(): method with press down arrow key of Keyboard
Example:
keyPress(KeyEvent.VK_DOWN)
keyRelease(): method with release down arrow key of Keyboard:
Example:
robot.keyRelease(KeyEvent.VK_DOWN)
mouseRelease() method will release the right click of your mouse
Example:
mouseRelease(InputEvent.BUTTON3_DOWN_MASK)
mouseMove() method will move mouse pointer to the specified X and Y coordinates.
Example:
robot.mouseMove(point.getX(), point.getY())
mousePress() method will press the right click of your mouse.
Example :
robot.mousePress(InputEvent.BUTTON3_DOWN_MASK)
You should pass the username and password with URL:
https://username:password@url
https://creds:test@www.test.com
Selenium Grid has following advantages: multi-browser testing, parallel test case execution, multi-platform testing.
testng.xml file is used to configure the whole a test suite. Here we can create a test suite, create test groups, mark tests for parallel execution, add listeners and pass parameters to test scripts. It can be used for the further test suite triggering.
☛ Members of multiple people team working on the same project can update its details and inform other team members simultaneously
☛ You can build the project from the remote repository regularly by using Jenkins. This helps you to keep track of failed builds.
Object repository is an essential entity in any UI automation which allows a tester to store all object that will be used in the scripts in one or more centralized locations rather than scattered all over the test scripts.
Java API IText is required for generating pdf reports.
The script is shown by Selenium IDE source view in XML format.
getOptions() is used to get the selected option from the drop-down list.
Neither captcha, no bar code reader can be automated by using Selenium.
driver.manage().window().maximize(); //command is used to maximize browser window in Selenium
A text written in a text field could be deleted by using the clear() method.
Selenese is the language which is used to write test scripts in Selenium IDE.
☛ Selenium is a free and open source. You don't need to spend any licensing cost to use it.
☛ Cross Browser compatibility (Firefox, Chrome, Internet Explorer, Safari etc.)
☛ Multiple programming languages (Java, C#, Ruby, Python, Pearl etc.) support
☛ Compatibility with the main platform (Windows, Mac OS, Linux etc.)
☛ Huge amount user base and helping communities
☛ Automation scripts creating ability for non-programmers as well as for programmers
☛ Testing distribution support
☛ Regular and fresh repository developments
Selenium IDE can be opened as a pop-up window or in side bar
To capture server side log in Selenium Server, you can use command: java –jar .jar –log selenium.log
We can use the same variable to work with multiple browsers like ChromeDriver, IEDriver by creating a reference variable of type WebDriver.