java - Couldn't Able to access Methods using Jmeter-Webdriver -
var pkg = javaimporter(org.openqa.selenium) var support_ui = javaimporter(org.openqa.selenium.support.ui.webdriverwait) var wait = new support_ui.webdriverwait(wds.browser, 5000) **var support_page=javaimporter(org.openqa.selenium.webdriver.timeouts)** **var support_p=new support_page.pageloadtimeout(30, timeunit.seconds)** var url = wds.args[0]; var user = wds.args[1]; var pwd = wds.args[2]; wds.sampleresult.samplestart() wds.browser.get(url) var wait=new support_ui.webdriverwait(wds.browser,15000) var username = wds.browser.findelement(pkg.by.id('login_txtusername')).sendkeys([user]) //username.click() //username.sendkeys(['pandian']) var userpwd = wds.browser.findelement(pkg.by.id('login_txtpassword')).sendkeys([pwd]) //userpwd.click() //userpwd.sendkeys(['1234']) var button = wds.browser.findelement(pkg.by.id('login_btnlogin')).click() //button.click()
when try import webdriver.timeouts
class it's imported not able access method pageloadtimeout
, when run jmeter says
response message: javax.script.scriptexception: sun.org.mozilla.javascript.internal.ecmaerror: referenceerror: "timeunit" not defined. (#5) in @ line number 5
can please provide me code jmeter access pageloadtimeout()
?
there easier , better way things done. try following code:
var timeunit = java.util.concurrent.timeunit wds.sampleresult.samplestart() wds.browser.manage().timeouts().pageloadtimeout(1, timeunit.seconds); wds.browser.get('http://google.com') wds.sampleresult.sampleend()
see using selenium jmeter's webdriver sampler guide more details on selenium scripting in apache jmeter using webdriver sample plugin.
Comments
Post a Comment