1
votes

I have been trying everything I can to get Selenium web driver (I'm using Java) to click this element:

<div class="nav_button proceed ready_button"><a href="" class=""><span data-localize="DIAGNOSIS_MPN_DIAGNOSIS" class="">MPN Diagnosis</span></a></div> 

The div is used to put a button graphic over the link.

I've tried xPath and locating it as linkText for "ABC Diagnosis" and neither work. The sendKeys(Keys.RETURN) trick will not work for this link. Selenium IDE uses an xPath and it works fine there, but does not work for the Web Driver. I don't know if the localized text part is tripping up the web driver somehow.

I did make sure to wait for the element to be visible. There isn't a problem with that.

Update: I figured out my problem. See my comment below.

2

2 Answers

1
votes

Have you tried the below xpath?

//a[contains(text(),'ABC Diagnosis')]

OR

//a[@data-localize="DIAGNOSIS_ABC_DIAGNOSIS"]

Let me know if it works for you.

1
votes

I found the issue. I didn't realize that clicking away a dialog right before trying to click this button was part of the problem. Apparently there is an overlay to prevent users from clicking outside of the dialog that was used. I have a wait for the overlay to go away, and now the clicking works great with a xpath. Credit to this resource for making me realize this issue: https://jkotests.wordpress.com/2015/03/20/element-is-not-clickable-due-to-another-element-that-would-receive-the-click/.