My Problem

I'm trying to automate a login/logout test to my website using Selenium IDE and I'm facing a problem while trying to verify a value displayed in the page.

In my test I first verify the title of the page using "store title" and then "verify" with the target "title" and the name of my website name in "value" and it works correctly.

However, when I want to verify a random string in my website which is in a span like that I'm facing an issue. (there's no other way in the website to see the username we used to connect)

<span style="font-weight:bold;">admin</span>

I didn't find anything that could allow me to store the value which is not in the span directly with a tag like "value=admin" or "username=admin" where I could use "store attribute" for example.

What I tried

Also, I tried using the "store text" command using "Select target in page" (it gives me : css=span:nth-child(3)) and then click on the text and associate it with value "admin" but when I try to verify that the target "admin" equals to value "admin" it says : "Actual value '' did not match 'admin'"

Similar Question

Similar but uses Selenium Webdriver : How can I get the value from span class in selenium?

1 Answer 1


Solution found

I've found the solution by using the "store text" command and select a target which was proposed automatically by the IDE himself different from what I've tried before.

Here's the target : xpath=//div[@id='main_frm:j_idt95_content']/span[2] (the type is an xpath:idRelative)

Then I just put it in a value and use the "verify" command to compare it to the string I wanted.


As said in the comments by Michael, it seems that it's a temporary solution which is not as exact as I think it was.

  • I recommend you wait for a better answer from others. Because it ois better to prefer css over xpath, avoid div tag, not use id, not use dynamically generated ID, not use span, not use numbered span. Essentially the code here will work but will break the first time the page is changed or even redeployed (the dynamic ID). Also as you are just getting started you will likely copy and paste this a lot. Solution is to take some course and read some books in order to learn more about better ways Jul 3, 2023 at 11:34
  • Thank you for your answer and advice, I'll let it open then. I didn't think at first at what you said which is pretty a smart reasoning. I will continue to search and to look at this post so Jul 3, 2023 at 12:17

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.