kaliiiiiiiiii / Selenium-Driverless

undetected Selenium without usage of chromedriver
https://kaliiiiiiiiii.github.io/Selenium-Driverless/
Other
412 stars 52 forks source link

How to propose text on elements #211

Closed hn315 closed 2 months ago

hn315 commented 2 months ago

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 2 months ago

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

kaliiiiiiiiii commented 2 months ago

@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 2 months ago

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