javascript - JMeter WebDriver Sampler: working with Firefox but browser does not open when using Chrome -
i have been able run (javascript) test script using webdriver sampler in jmeter firefox driver config. want use jmeter chrome driver config run same test in chrome.
i know chrome driver have installed on pc working have used run other (non-jmeter) tests. path chrome driver correct.
my site not use proxy have selected "no proxy" under "proxy" tab of chrome driver config.
problem: when click "run" in jmeter firefox driver config disabled , chrome driver config enabled, nothing happens (browser not open, test ends , nothing recorded in "view results tree" listener).
i using version 3.1 of jmeter, version 60.0.3112.101 of chrome , version 2.31 of chromedriver.
my code looks in case helps:
var pkg = javaimporter(org.openqa.selenium); //webdriver classes var pfg = javaimporter(org.openqa.selenium.keys); //webdriver classes var support_ui = javaimporter(org.openqa.selenium.support.ui.webdriverwait); var wait = new support_ui.webdriverwait(wds.browser, 5000); var username = wds.args[0]; var password = wds.args[1]; var docno = wds.args[2]; wds.sampleresult.samplestart(); wds.sampleresult.getlatency(); wds.log.info("sample started"); wds.browser.get('blah blah blah'); var usernamebox = wds.browser.findelement(pkg.by.id('textboxcustomer')); var passwordbox = wds.browser.findelement(pkg.by.id('pin')); var loginbtn = wds.browser.findelement(pkg.by.id('btnlogin')); usernamebox.click(); //click on user id textbox usernamebox.sendkeys([username]); //enter user id passwordbox.click(); //click on password textbox passwordbox.sendkeys([password]); //enter password loginbtn.click(); //click login button java.lang.thread.sleep(5000); //check "home" page has been reached verifying presence of "news header" try { wait.until(conditions.presenceofelementlocated(pkg.by.id('ct100_cp1_ctlnewsmessa gelist_newsheader'))); } catch (exception) { wds.sampleresult.sampleend(); wds.sampleresult.setsuccessful(false); } //navigate "invoice pdfs" screen var accountmnu = wds.browser.findelement(pkg.by.xpath("//[contains(text(),'account')]")); accountmnu.click(); var invpdfsubmnu = wds.browser.findelement(pkg.by.xpath("//* [contains(text(),'invoice pdfs')]")); invpdfsubmnu.click(); java.lang.thread.sleep(5000); try { wait.until(conditions.presenceofelementlocated(pkg.by.id('ctl00_cp1_tbdocno'))); } catch (exception) { wds.sampleresult.sampleend(); wds.sampleresult.setsuccessful(false); } //enter document number java.lang.thread.sleep(5000); var docnobox = wds.browser.findelement(pkg.by.id('ctl00_cp1_tbdocno')); docnobox.click(); //click on "doc bo." textbox docnobox.sendkeys([docno]); //enter doc no. java.lang.thread.sleep(5000); //retrieve document specified document number var retrievebtn = wds.browser.findelement(pkg.by.id('ctl00_cp1_btnretrieve')); retrievebtn.click(); try { wait.until(conditions.presenceofelementlocated(pkg.by.xpath("//*[contains(text(),'download')]"))); } catch (exception) { wds.sampleresult.sampleend(); wds.sampleresult.setsuccessful(false); } java.lang.thread.sleep(5000); //click on "download" button var downloadbtn = wds.browser.findelement(pkg.by.xpath("//*[contains(text(),'download')]")); downloadbtn.click(); wds.sampleresult.sampleend();
it seems solution in "path chrome driver" (under "chrome" tab of "jp@gc - chrome driver config" element) needed end "path" "\chromedriver.exe".
Comments
Post a Comment