Asked By – user3121891
I’m trying to get text using Selenium WebDriver and here is my code. Please note that I don’t want to use XPath, because in my case the ID gets changed on every relaunch of the web page.
text = driver.find_element_by_class_name("current-stage").getText("my text")
<span class="current-text" id="yui_3_7_0_4_1389185744113_384">my text</span>
How can I fix this?
Now we will see solution for issue: How to get text with Selenium WebDriver in Python
You want just
You can then verify it after you’ve got it, don’t attempt to pass in what you expect it should have.
This question is answered By – Arran
This answer is collected from stackoverflow and reviewed by FixPython community admins, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0