javascript - Making the web page to wait to load to identify the frame id -
the js program wrote in node.js is:
var webdriver = require("selenium-webdriver"); function createdriver() { var driver = new webdriver.builder() .usingserver('http://localhost:4444/wd/hub') .withcapabilities(webdriver.capabilities.chrome()) .build(); driver.manage().timeouts().setscripttimeout(900000); return driver; } var driver = createdriver(); driver.get('https:webpage-url'); driver.findelement(webdriver.by.name('username')).sendkeys('abcd'); driver.findelement(webdriver.by.name('password')).sendkeys('pswd'); driver.findelement(webdriver.by.id('button')).click(); driver.findelement(webdriver.by.name('abcd')).sendkeys('abcd'); driver.findelement(webdriver.by.id('button')).click(); driver.findelement(webdriver.by.name('deprt')).sendkeys('dept)'); driver.findelement(webdriver.by.id('abutton')).click(); driver.manage().timeouts().implicitlywait(1000000); driver.switchto().defaultcontent(); driver.switchto().frame("frameid"); driver.findelement(webdriver.by.id('pbutton')).click();
i tried using implicitlywait function before calling frame element doesn't wait , error nosuchframeerror getting displayed.
also used driver.wait(10000) before calling iframe element says timedout instead of executing remaining steps. please me on
you need use explicit wait, explained here. script wait particular "frameid" display, before switching it.
edited: added sample code:
driver.wait(function() { return driver.findelement(webdriver.by.id('frameid')).isdisplayed(); }, 30);
Comments
Post a Comment