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!

user3713453
  • 97
  • 1
  • 5
  • 14
  • 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. – Sham Jun 30 '15 at 03:40
  • @Sham Yes clicking that show details link button will show this image. See my original post for updated details – user3713453 Jun 30 '15 at 03: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? – Sham Jun 30 '15 at 04:00
  • @Sham not sure if i get you correclty but i will try to post the whole html above. Thank you again – user3713453 Jun 30 '15 at 05:55
  • fixed! this element is inside the frame – user3713453 Jul 10 '15 at 00:58

4 Answers4

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.

Sourav
  • 36
  • 1
1

Try xpath text based search

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

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

Saifur
  • 16,081
  • 6
  • 49
  • 73
  • 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. – user3713453 Jun 30 '15 at 02:09
  • Can you please replace the image with `html`? – Saifur Jun 30 '15 at 04:10
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")); 
Sham
  • 830
  • 9
  • 27
  • This will not be applicable since page have many action menu text. Thanks – user3713453 Jun 30 '15 at 02:06
  • 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. – Sham Jun 30 '15 at 02:12
  • Yes sham thanks for the advise. I will try to edit again my thread. really grateful for your response – user3713453 Jun 30 '15 at 02:15
1

Please try something like this:

//*[@id='76']//span[@class='message-action-menu-text']
san1deep2set3hi
  • 4,904
  • 1
  • 23
  • 23