程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
您现在的位置: 程式師世界 >> 編程語言 >  >> 更多編程語言 >> Python

Use of Python selenium Library (control of open web pages)

編輯:Python
  •   Download what you need chrome drive , Place a directory , Create chromedriver Use , For example, I put it in C:\Program Files (x86)\Google\Chrome\Application\chromedriver.exe
  • Then enter chrome Under the folder ( Right click chrome browser , Open the folder ),shift+ Right click to open the command line , Run the following :
chrome.exe --remote-debugging-port=9527 --user-data-dir=“D:\pycharm\zdh_rxy"
--remote-debugging-port Remote control interface
--user-data-dir For project directory
 You can log in to the website you want to log in , Subsequently, you can directly control the opened web page .
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.chrome.service import Service
from selenium.webdriver.common.by import By
import time
import watch
options = Options()
options.add_experimental_option("debuggerAddress", "127.0.0.1:9527")
# chromedriver The directory where the driver is located
chromedriver = "C:\Program Files (x86)\Google\Chrome\Application\chromedriver.exe"
s = Service(chromedriver)
browser = webdriver.Chrome(service=s, options=options)
while(True):
( Control code snippet ...)


  1. 上一篇文章:
  2. 下一篇文章:
Copyright © 程式師世界 All Rights Reserved