selenium 浏览器检测 绕过

  • Post author:
  • Post category:其他


from selenium.webdriver import Chrome
import time
from selenium import webdriver

option = webdriver.ChromeOptions()
option.add_experimental_option(
            'excludeSwitches',
            ['enable-automation'])
driver = webdriver.Chrome(chrome_options=option)
driver.maximize_window()
driver.get('http://www.porters.vip/features/webdriver.html')
#定位按钮并点击
driver.find_element_by_css_selector('.btn.btn-primary.btn-lg').click()
#定位到文章内容元素
elements = driver.find_element_by_css_selector('#content')
time.sleep(1)
print(elements.text)
driver.close()

以开发者模式运行selenium



版权声明:本文为lyhfight原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。