Selenium Cheatsheet
Selenium Cheatsheet
MaheshMQspiders,MysorePage1
SeleniumWebDriver
5 Navigate to frame driver.switchTo().frame(frame); frame can be integer value
represents position of frame or
string represents id of frame or
WebElement represents frame
of
frame.
6 Navigate to next driver.switchTo().window(hashCode); hashCode is hash code of window
window or pop up
MaheshMQspiders,MysorePage2
https://t.me/Tcs_wings_2022
SeleniumWebDriver
window
7 Get inner text of driver.findElement(locator).getText(); locator is a location element
element or inner text
of table
MaheshMQspiders,MysorePage3
https://t.me/Tcs_wings_2022
SeleniumWebDriver
0 to save in desktop
1 Save in downloads folder in your computer
2 User defined path
If the value is 2 then we have to set browser.download.dir preferences to path of specific folder.
MaheshMQspiders,MysorePage4
SeleniumWebDriver
MaheshMQspiders,MysorePage3
SeleniumWebDriver
1 Capture File scrFile1 = It captures screen shot of
screen ((TakesScreenshot)driver).getScreenshotAs(OutputType.FI particular page and
LE); stores it in variable
2 Save to disk FileUtils.copyFile(scrFile1, new File("c:\\tmp\\k2.png")); Save screen shot
as k2.png
MaheshMQspiders,MysorePage4
SeleniumWebDriver
MaheshMQspiders,MysorePage5
SeleniumWebDriver
MaheshMQspiders,MysorePage6
SeleniumWebDriver
T1 Excel sheet
T2 TestE
Driver Excel
xecutor
T3 Library
T4
Frame Explain
1. Our frame work is keyword hybrid frame work which runs from excel.
2. Driver is the starting point of execution. Driver launches the application, adds the required tests to
the test suite, and runs the test suite. The test required to run will be present in excel file called
“TestScenarios”. The sheet called test suit in excel file contains list of all the test cases to be run with
execution status against each script. If execution status is yes the test is executed else it is skipped.
3. Driver has the code to read this excel sheet and based on the execution status, script will be added to
the test suite.
4. We use TestN(JUnit) to execute the tests.
5. When driver runs the tests, it creates an object of test executor class and calls the execute test method.
6. Test executor connects to excel through the particular sheet of the scenario which is running,
loops through all the test steps, and executes the steps.
7. To connect with excel, apache POI API are used. The inbuilt methods are used get data from
excel sheet.
8. When each step is executed, script checks the element is present and performs the action. For
every action performed log message is generated which is written back to the excel sheet.
MaheshMQspiders,MysorePage7