Are you certain that, in the DOM, the button element itself holds the click event? In the application that I test, the dev team tends to wrap buttons in a few extra div elements for style and then defines the click event in one of those div tag’s onClick= … Like in your case, if I select the actual button element but it has no click event defined in DOM, nothing happens… an example of xPath from my project that selects the button’s parent which has the actual click event…
“//button[text()=‘Done’]/…/…/…”
@Smitty: Thanks for your inputs. I tried using parent level but still i am not able to proceed further.
pagesourcecode() for ref -
Username
Password
Login
1
2
3
<
4
5
6
7
8
9
(+/-)
0
.
Done
@Note: I am able to click the element manually. Verified below xpath,
WebElement loginbtn = driver.findElement(By.xpath("//div[text()=‘Login’]/…"));
//button[@type=‘button’] //android.widget.Button
//button[@aria-label=‘LoginButton’]/…
loginbtn.click();
@jhaskumar: Before login I am trying to provide user credentials, which is working fine, directly through sendkeys() & even I am able to click on input field. code for username is as below,
Try using the Preformatted text modifier (the HTML tag looking button between the Quotes and Up Arrow) on your HTML … or wrap it in ticks …" ` " … so that our browsers show the raw code instead of trying to render it:
<div id="foo"> <ul> <li></li> </ul> </div>
I still suspect that, while you are getting the element you are looking for, that element does not contain the click event that you need… But I would need to see the un-rendered HTML to confirm that…