selenium4+python自动发帖,正文一直定位不了?
比如我要在csdn论坛自动发帖:
import time
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.chrome.options import Options
chrome_options = Options()
chrome_options.add_experimental_option("debuggerAddress", "127.0.0.1:9222")
chrome_driver = "C:\\Users\\lenovo7\\AppData\\Local\\Google\\Chrome\\Application\\chromedriver.exe"
driver = webdriver.Chrome(chrome_driver, chrome_options=chrome_options)
print(driver.title)
element=driver.find_element(By.CLASS_NAME,'pub-img')
element.click()
time.sleep(2)
element=driver.find_element(By.ID,'txtTitle')
element.clear()
element.send_keys('用户名fdsfgdgdgdfg')
time.sleep(2)
接下来正文不知道怎么定位输入内容了,求指点。
直接定位输入框,用send_keys 找text area定位
页:
[1]