3

Hi all I'm having a problem in this scenario. Please do give suggestion on what to to do.

Tried using this xpath (not working):

.//*[@id='76']/div/div[3]/span[1]/span

Please do help me.

Note: The 'Show Details' link are clickable they have different ID's, the one in yellow tag is the one that cannot click.

I appreciate for all of those who will share their ideas about this Thanks!

5
  • Is there a way to find the text shown (like Employee 545454...) above the Show Details link? Because I don't see it in HTML. Commented Jun 30, 2015 at 3:40
  • @Sham Yes clicking that show details link button will show this image. See my original post for updated details Commented Jun 30, 2015 at 3:51
  • Buddy, let me put it this way. In order to click Nth Show Details link in the UI, we need to know which link needs to be clicked. From the first image, we can say Show Details[2], because we identified it with some test data around like Employee.... So in order to get exactly what Show Details link to be clicked, we need that test data associated with that link. If possible get the HTML of the Employee 5454.., without opening show details link? Commented Jun 30, 2015 at 4:00
  • @Sham not sure if i get you correclty but i will try to post the whole html above. Thank you again Commented Jun 30, 2015 at 5:55
  • fixed! this element is inside the frame Commented Jul 10, 2015 at 0:58

4 Answers 4

2

You can try as below:

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

As you are saying the id for 'Show Details' is keep on changing, then you have to put the current id in place of 76.

This xpath will hopefully work for you.

Sign up to request clarification or add additional context in comments.

1 Comment

Hi @Sourav Thanks for the response. though this seems not to be working.
1

Try xpath text based search

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

It allows you to find the span without caring about the spaces

2 Comments

I already tried this and still NoElementException occured. I think because the text have the same labels like that, they just varies in the ID like 75 , 76, 77.. Thanks for answering bro.
Can you please replace the image with html?
1

Can use class name as well.

// 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")); 

3 Comments

This will not be applicable since page have many action menu text. Thanks
There is nothing mentioned in the OP that there are multiple classes with same class name. Also, this is a just a solution, if you have more than one element, we can use indexing. Not providing ID attribute to the elements is not a proper way of designing the page and event that is not acceptable :). Post the HTML of the page instead of Image, which might get more responses.
Yes sham thanks for the advise. I will try to edit again my thread. really grateful for your response
1

Please try something like this:

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

1 Comment

Hi i also tried this, but same result no element cant be found. thanks for the help. :(

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.