java - Selenium Webdriver - Cannot click button - Finds element -


hopefully can me solution problem. have spent better part of day trying every solution can find on here , through google.

i cut chase. have test logs in on 1 screen. second screen selects role , moves on. able role selection screen, cannot move forward selenium not click button, regardless of do.

the interesting thing work ide, exporting code java , running webdriver not work either. part makes no sense me think ide export should run easily. difference can see webdriver pulls profile-less firefox, whereas ide running on profile - not sure have it, wanted throw out there.

the difference between first button , second button autofocus command in html.

<button data-submit-button="" class="btn" autofocus="" name="submit" type="submit">go</button> 

i've tried numerous solutions found throughout web , last thing i've tried is

 new webdriverwait(driver,120).until(expectedconditions.elementtobeselected(by.name("submit")));     driver.findelement(by.name("submit")).click(); 

this not work either. have tried several variations on , of time webdriver either times out or skips through step, passing , failing on next steps page has not moved forward.

does have suggestions? if have questions or can give more information if haven't given enough! amazing, i've spent better part of day trying through 1 issue.

thanks!

sometimes selector main issue in scenario this. also, name="submit" not safe selector use since developers have tendency duplicate same attribute across form. without knowing actual elements can pretty tell issue selector. if text go text of button on page, give following xpath shot

//button[@name='submit'][@type='submit'][contains(text(),'go')] 

complete implementation should follows:

by xpath = by.xpath("//button[@name='submit'][@type='submit'][contains(text(),'go')]"); webelement mydynamicelement = (new webdriverwait(driver, 10))   .until(expectedconditions.presenceofelementlocated(xpath));  mydynamicelement.click(); 

Comments

Popular posts from this blog

javascript - Bootstrap Popover: iOS Safari strange behaviour -

Magento/PHP - Get phones on all members in a customer group -

session - Logging Out Using PHP -