kaliiiiiiiiii/Selenium-Driverless

How to propose text on elements

hn315 opened this issue · 3 comments

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)`

use WebElement.execute_script with obj.textContent= "some text"

@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

@kaliiiiiiiiii
Thank you .Finally succeeded with your code. I'm a beginner and don't know how to use it, sorry.