javascript - Why does WebDriver not move to the next page when "clicking" an element? -
i doing:
driver = new webdriver.builder() .forbrowser('safari') .build(); var referrer = 'http://localhost:3000/tours/hood-river'; // console.log(referrer); driver.get(referrer); driver.findelement(by.id('requestgrouprate')).click(); //requestgrouprate link, clicking should move new page driver.wait(function(){ return driver.findelement(by.id('mything')).then(function(element){ console.log("hereere"); assert(element.value === referrer); done(); }); },10000);
i find findelement(by.id('mything'))
, fails, though page should on has 'mything'. if change line
driver.findelement(by.id('requestgrouprate'))..
then element found! leads me believe, click() not cause driver navigate link.
edit: link trying click on:
<a id="requestgrouprate" href="/tours/request-group-rate">request group rate.</a>
you can add driver.sleep(10000) after click() debug purpose.
if page changed, means link , click() worked , possible failed reason it's when script click on link, page still loading, browser failed response click event.
then can move driver.sleep(10000) after browser.get() see click() can work or not.
Comments
Post a Comment