How do I click a dynamic element in a span class? Selenium WebDriver

Hi everyone, I am having a problem in this scenario. Please give a suggestion on what to do.

Tried using this xpath (doesn't work):

.//* [@ID = '76'] / div / div [3] / shell [1] / range

Please help me.

Note. The Show Details link can be clicked, they have different IDs, the ones in the yellow tag cannot be clicked.

I appreciate all those who share their ideas on this. Thank you!

+3


source to share


4 answers


You can try this:

xpath = (// span [text (), 'Show Details']) [76]



As you say the ID for Show Details keeps changing, then you have to put the current ID instead of 76.

This xpath will hopefully work for you.

+2


source


Try xpath based text search

//span[contains(text(),'Show Details')]

      



It lets you find a gap without worrying about spaces

+1


source


You can use class name

.

// driver is the selenium driver object. Need to make sure, compound names are not allowed
IWebElement span = driver.FindElement(By.ClassName("message-action-menu-text")); 

      

+1


source


Try something like this:

//*[@id='76']//span[@class='message-action-menu-text']

      

+1


source







All Articles