How to propose text on elements
hn315 opened this issue · 3 comments
hn315 commented
How to propose text on elements?My following code reported an error. May I ask how to modify it
`msg = await driver.find_element(By.XPATH, '/html/body/div[1]/div/div/div/div[2]/div/div/form/div[5]/span', timeout=10).text
print(msg)`
kaliiiiiiiiii commented
use WebElement.execute_script with obj.textContent= "some text"
kaliiiiiiiiii commented
@hn315
to get the text, you'll have to use
text = await (await driver.find_element(By.XPATH, '/html/body/div[1]/div/div/div/div[2]/div/div/form/div[5]/span', timeout=10)).text
btw
hn315 commented
@kaliiiiiiiiii
Thank you .Finally succeeded with your code. I'm a beginner and don't know how to use it, sorry.