TA的每日心情 | 无聊 昨天 09:47 |
---|
签到天数: 528 天 连续签到: 1 天 [LV.9]测试副司令
|
1测试积点
比如我要在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)
-
复制代码 接下来正文不知道怎么定位输入内容了,求指点。
|
|