admin管理员组文章数量:1026942
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便于打开网页
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便于打开网页
版权声明:本文标题:爬虫相关python+selenium在已经打开的浏览器上操作 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://it.en369.cn/jiaocheng/1726854496a674237.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论