Monday, 15 March 2010

java - Selenium HtmlUnitDriver not clicking on button -



java - Selenium HtmlUnitDriver not clicking on button -

i want click on button:

<input type="submit" value="stock!" class="button" tabindex="5" />

here code:

webelement stock = driver.findelement(by.xpath("//*[@id=\"stock\"]/table/tbody/tr[4]/td/input[5]")); stock.click();

the programme runs without throwing errors, button not beingness clicked, , programme not completing task.

try using sendkeys instead of click. although looks strange, has worked me in many times.

stock.sendkeys(keys.enter);

or can shown below. automatically submit values in particular form element present. life made easy.

stock.submit();

not necessarirly should utilize input (type=submit) submit() action. can utilize other element in html form.

java button selenium webdriver

No comments:

Post a Comment