java - Cross browser testing on Selenium using NetBeans -
i've been working selenium webdriver 2 weeks now. came across tutorials on youtube on how test selenium on multiple browsers. but, of tutorials run using eclipse. video shows implementing xml file , running xml file. tried doing on netbeans, doesn't seem run.
is there way run xml file or there way can run script on multiple browsers using netbeans?
this java file:
public class hotel_tree_of_life { extenthtmlreporter htmlreporter = new extenthtmlreporter("d:\\selenium\\report_v3.html"); extentreports extent = new extentreports(); extenttest test; javascriptexecutor jse; webdriver driver; @beforetest @parameters("browser") public void setup(string browser) { if(browser.equalsignorecase("firefox")) { system.setproperty("webdriver.gecko.driver", "d:\\selenium\\geckodriver.exe"); driver = new firefoxdriver(); } else if(browser.equalsignorecase("chrome")) { system.setproperty("webdriver.chrome.driver", "d:\\selenium\\chromedriver.exe"); driver = new chromedriver(); } else { system.setproperty("webdriver.ie.driver", "d:\\selenium\\edgedriver.exe"); driver = new edgedriver(); } driver.manage().window().maximize(); driver.manage().deleteallcookies(); extent.attachreporter(htmlreporter); jse = (javascriptexecutor)driver; jse.executescript("window.scrollby(0,250)", ""); driver.get("https://www.hoteltreeoflife.com/reservation/"); } }
this xml file:
<?xml version="1.0" encoding="utf-8"?> <suite name="suite" parallel="none"> <test name="test"> <parameter name="browser" value="firefox" /> <classes> <class name="extent_v3.hotel_tree_of_life" /> </classes> </test> <test name="ietest"> <parameter name="browser" value="edge" /> <classes> <class name="extent_v3.hotel_tree_of_life" /> </classes> </test> </suite>
this xml file test runner file, more specific testng, make sure use testng , not junit (usually default test runner in ide's)
Comments
Post a Comment