Showing posts with label "Automated Testing" "selenium tutorial for beginner" "selenium". Show all posts
Showing posts with label "Automated Testing" "selenium tutorial for beginner" "selenium". Show all posts

Selenium Webdriver Architecture


This diagram is just to show how Selenium Webdriver works. If anyone asks for Selenium Webdriver architecture then just need to design the below diagram and explain it. I share this as it is one of the most frequently asked Selenium Question

Selenium Architecture
Selenium Webdriver Architecture

Selenium New Version i.e. 2.42.0


Selenium new version is available i.e 2.42.0 , please download it from below link and update your libraries so that you will not face any compilation or any other version related issue:

http://goo.gl/l3AasO

To stay update, just like my Facebook page

TestNG Error Codes


We write automation framework using TestNG and when we run it we get errors sometimes. So, it becomes important for us to know about error messages. 

I have put some of the error messages that we get when we go wrong and execute TestNG XML file:

1.If two tests are having the same name then we see below error

at org.testng.TestNG.checkTestNames(TestNG.java:981)
at org.testng.TestNG.sanityCheck(TestNG.java:970)
at org.testng.TestNG.run(TestNG.java:1002)
at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:109)

2.If the testname doesnot enclosed in double quotes("") then we get below error


Basic Selenium Commands


Below are some basic commands of selenium which you can try and use while writing your script for automation of any website. If you face any problem, you can raise your query by completing the form available at Contact Us page:

  1. driver.get("http://www.google.com"); To open an application
  2. driver.findElement(By.id("passwd-id")); Finding Element using Id
  3. driver.findElement(By.name("passwd")); Finding Element using Name
  4. driver.findElement(By.xpath("//input[@id=’passwd-id’]")); Finding Element using Xpath
  5. element.sendKeys("some text"); To type some data
  6. element.clear(); clear thecontents of a text field or textarea
  7. driver.findElement(By.xpath("//select")); Selecting the value
  8. select.findElements(By.tagName("option")); Selecting the value
  9. select.deselectAll(); This will deselect all OPTIONs from the first SELECT on the page
  10. select.selectByVisibleText("Edam"); select the OPTION withthe displayed text of “Edam”
  11. findElement(By.id("submit")).click(); To click on Any button/Link
  12. driver.switchTo().window("windowName"); Moving from one window to another window
  13. driver.switchTo().frame("frameName"); swing from frame to frame (or into iframes)
  14. driver.switchTo().frame("frameName.0.child"); to access subframes by separating the path with a dot, and you can specify the frame by itsindex too.
  15. driver.switchTo().alert(); Handling Alerts
  16. driver.navigate().to("http://www.example.com"); To Navigate Paeticular URL
  17. driver.navigate().forward(); To Navigate Forward
  18. driver.navigate().back(); To Navigate Backword
  19. driver.close(); Closes the current window
  20. driver.quit(); Quits the driver and closes every associated window.
  21. driver.switch_to_alert(); Switches focus to an alert on the page.
  22. driver.refresh(); Refreshes the current page.
  23. webdriver.manage().window().setPosition(new Point(-2000, 0); to minimize browser window

Prerequisites to Start Learning Selenium Webdriver


You will need the following to start using Selenium WebDriver or in other words you can say prerequisites required to setup Selenium Webdriver??


  • Java Development Kit (JDK) ( To download it, click here)
  • Eclipse IDE - (To download it, click here)
  • Jar Files (Java Client Driver) - (To download it, click here)