time out when clicking an element using selenium webdriver -
i have issue when trying click link text. problem page load long , causes exception : "command duration or timeout: 60.01 seconds". set :
driver.manage().timeouts().implicitlywait(30, timeunit.seconds); driver.manage().timeouts().pageloadtimeout(180, timeunit.seconds); driver.manage().timeouts().setscripttimeout(180, timeunit.seconds);
it's time out in 60.01 seconds, code can't overwrite default time out of pageload. i'm using chrome driver. here code :
driver.get(baseurl + "?k=" + test.key); // verify mocoin icon exists asserttrue("the 'mocoin' icon not exist", driver.findelements(by.id("tokens-navbar")).size() != 0); // verify 'pronews' menu exists asserttrue("the 'pronews' menu not exist", driver .findelements(by.linktext("pronews")).size() != 0); // click on 'pronews' menu driver.findelement(by.linktext("pronews")).click(); // exception here, element clicked , new page loading
is there way overwrite time out of pageload ? or trick stop page load can verify title , other elements ? greate.
please try below code wait 7 seconds polling time of 50 ms - change time per convenience -
new webdriverwait(driver,7,50).until(expectedconditions.texttobepresentinelementlocated(by.linktext("pronews"), "pronews")); driver.findelement(by.linktext("pronews")).click();
Comments
Post a Comment