爬虫相关python+selenium在已经打开的浏览器上操作

cmd运行 chrome.exe --remote-debugging-port9222 --user-data-dir"C:selenumAutomationProfile"from selenium impor

cmd运行

chrome.exe --remote-debugging-port=9222 --user-data-dir="C:\selenum\AutomationProfile"

from selenium import webdriver
from selenium.webdriver.chrome.options import Options
 # -*- coding: utf-8 -*-
import random
import time

from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.wait import WebDriverWait














chrome_options = Options()
chrome_options.add_experimental_option("debuggerAddress", "127.0.0.1:9222")
chrome_driver = "C:/Users/MSI-CN/AppData/Local/Google/Chrome/Application/chromedriver.exe"
driver = webdriver.Chrome(chrome_driver, chrome_options=chrome_options)
print(driver.title)#目前网页的标题








browser = driver


url="这里输入要访问的目标网址"
browser.get(url)#括号里面输入要访问的网址




time.sleep(20)#暂停20s便于打开网页

发布者:admin,转转请注明出处:http://www.yc00.com/web/1742568087a4460035.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信