0
For example, in this line of code I need "x+10=10". Someone knows how to do?
<span class="task" onclick="loadExercise(201)" id="task201">x+10=10</span>
0
For example, in this line of code I need "x+10=10". Someone knows how to do?
<span class="task" onclick="loadExercise(201)" id="task201">x+10=10</span>
1
If you are using python for example you can use . text:
name = driver.find_element_by_id("task201").text
print (name)
x+10=10
0
I guess that’s it:
var elemento = browser.FindElement(By.Id("task201")).Text;
or
var elemento = browser.FindElement(By.Id("task201")).GetAttribute("innerText");
0
You first need to identify whether the element is dynamic or whether it is part of a list and each time it appears may be in a different location, the most common and safe way to capture text is like this:
texto String;
texto = driver.findElemnt(By.xpath(//span [text()='x+10=10'])).text; //desta forma ele vai localizar o texto mesmo que ele mude de posição na pagina
Browser other questions tagged selenium selenium-webdriver
You are not signed in. Login or sign up in order to post.
I don’t know exactly what you mean to use Selenium, but see if this answers: http://answall.com/questions/163557/-pego-texto-entre-uma-tag/163561#163561
– MagicHat
I think it will depend on the language you want to use: Java, Python, C#...
– Sam