本文最后更新于 2024-07-26T20:49:51+08:00
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
| import time from selenium import webdriver driver = webdriver.Chrome() url="https://www.baidu.com" driver.get(url) time.sleep(2)
input=driver.find_element(by='id',value='kw')
input.send_keys('周杰伦')
button=driver.find_element(by='id',value='su')
button.click() time.sleep(2)
js_bottom="document.documentElement.scrollTop=100000" driver.execute_script(js_bottom) time.sleep(2)
next=driver.find_element(by='xpath',value='//a[@class="n"]') next.click() time.sleep(2)
driver.back() time.sleep(2) driver.forward()
time.sleep(3)
driver.quit()
|
selenium_信息交互2
https://ianwusb.blog/2024/07/26/selenium_信息交互2/