KEMBAR78
Selenium WebDriver- Training Material and QA | PPTX
Selenium WebDriver
By
Arti Tripathi & Amit Agarwal
Agenda
• What is Selenium Grid?
• What is Selenium Hub and Node?
• Setting up Selenium Grid 2 using multiple VMs.
– Configuring Grid 2 using webconfig.txt JSON format
configuration file.
– Running Grid 2 console in browser.
– Update setup method of BaseTestSetup.java file.
– Update TestNG.xml file.
• Run test scripts on multiple VMs using Grid 2.
What is Selenium Grid?
• Selenium-Grid allows you run your tests on
different machines against different browsers
in parallel. That is, running multiple tests at
the same time against different machines
running different browsers and operating
systems. Essentially, Selenium-Grid support
distributed test execution. It allows for
running your tests in a distributed test
execution environment.
What is Selenium Hub and Node?
• Hub – Implies selenium grid 2 hub which
distributes tests among multiple nodes
registered to it at runtime.
• Node – One node represents one machine
where test will be running & we can have
multiple nodes those will be registered with
one centralized hub which will be running on
anyone machine.
Setting up Selenium Grid 2 using
multiple VMs.
• Download latest version of selenium-server-
standalone-x.x.x.jar.
• Create JSON configuration file.
• Copying both ‘selenium-server-standalone-
x.x.x.jar’ and ‘webconfig.txt’ on number of
machines/VMs required for testing.
• Run Hub and Nodes.
Configuring Grid 2 using webconfig.txt
JSON format configuration file.
• browsersName & maxInstances
• port
• host
• hubPort
• hubHost
Running Grid 2 console in browser.
• Open the browser, Enter the following URL:-
http://put_hub_machine_name:4444/grid/co
nsole
(Note: - Don’t forget to enter the
“hub_machine_name” in above URL)
Update setup method of BaseTestSetup.java file
Update TestNG.xml file.
Run test scripts on multiple VMs
using Grid 2
Queries and Parking lot
Thank You

Selenium WebDriver- Training Material and QA

  • 1.
  • 2.
    Agenda • What isSelenium Grid? • What is Selenium Hub and Node? • Setting up Selenium Grid 2 using multiple VMs. – Configuring Grid 2 using webconfig.txt JSON format configuration file. – Running Grid 2 console in browser. – Update setup method of BaseTestSetup.java file. – Update TestNG.xml file. • Run test scripts on multiple VMs using Grid 2.
  • 3.
    What is SeleniumGrid? • Selenium-Grid allows you run your tests on different machines against different browsers in parallel. That is, running multiple tests at the same time against different machines running different browsers and operating systems. Essentially, Selenium-Grid support distributed test execution. It allows for running your tests in a distributed test execution environment.
  • 4.
    What is SeleniumHub and Node? • Hub – Implies selenium grid 2 hub which distributes tests among multiple nodes registered to it at runtime. • Node – One node represents one machine where test will be running & we can have multiple nodes those will be registered with one centralized hub which will be running on anyone machine.
  • 5.
    Setting up SeleniumGrid 2 using multiple VMs. • Download latest version of selenium-server- standalone-x.x.x.jar. • Create JSON configuration file. • Copying both ‘selenium-server-standalone- x.x.x.jar’ and ‘webconfig.txt’ on number of machines/VMs required for testing. • Run Hub and Nodes.
  • 6.
    Configuring Grid 2using webconfig.txt JSON format configuration file. • browsersName & maxInstances • port • host • hubPort • hubHost
  • 7.
    Running Grid 2console in browser. • Open the browser, Enter the following URL:- http://put_hub_machine_name:4444/grid/co nsole (Note: - Don’t forget to enter the “hub_machine_name” in above URL)
  • 8.
    Update setup methodof BaseTestSetup.java file
  • 9.
  • 10.
    Run test scriptson multiple VMs using Grid 2
  • 11.
  • 12.

Editor's Notes

  • #7 Sample webconfig.txt:- { "capabilities": [ { "browserName": "firefox", "acceptSslCerts": true, "javascriptEnabled": true, "takeScreenshots": true, "firefox_profile": "", "maxInstances": 3, "seleniumProtocol": "WebDriver" }, { "browserName": "chrome", "maxInstances": 3, "seleniumProtocol": "WebDriver" }, { "platform": "WINDOWS", "browserName": "internet explorer", "maxInstances": 4, "seleniumProtocol": "WebDriver" } ], "configuration": { "cleanUpCycle": 2000, "timeout": 30000, "proxy": "org.openqa.grid.selenium.proxy.WebDriverRemoteProxy", "maxSession": 5, "port": 5555, "host": noiam003ag-w1, "register": true, "hubPort": 4444, "hubHost" : noiam003ag-w1 } }
  • #9 BaseTestSetup.java :- public WebDriver setup(String BROWSER) throws MalformedURLException{ System.out.println("Browser: " + BROWSER); if (BROWSER.equals("FF")) { System.out.println("FF is selected"); capability = DesiredCapabilities.firefox(); capability.setBrowserName("firefox"); capability.setPlatform(org.openqa.selenium.Platform.ANY); driver = new RemoteWebDriver(new URL("http://noiam003ag-w1:4444/wd/hub"), capability); driver.get(baseURL); } else if (BROWSER.equals("IE")) { System.out.println("IE is selected"); capability = DesiredCapabilities.internetExplorer(); capability.setBrowserName("internet explorer"); capability.setPlatform(org.openqa.selenium.Platform.WINDOWS); } else if (BROWSER.equals("CH")){ System.out.println("Google chrome is selected"); System.setProperty("webdriver.chrome.driver", "C:/ChromeDriver/chromedriver.exe"); capability = DesiredCapabilities.chrome(); capability.setBrowserName("chrome"); capability.setPlatform(org.openqa.selenium.Platform.WINDOWS); driver = new RemoteWebDriver(new URL("http://noiam003ag-w1:4444/wd/hub"), capability); driver.get(baseURL); } System.out.println("Remote Driver setup"); return driver; }