码迷,mamicode.com
首页 > 编程语言 > 详细

python调用远程chromedriver.exe、selenium抓包方法

时间:2018-12-13 19:32:58      阅读:252      评论:0      收藏:0      [点我收藏+]

标签:server   path   tor   stderr   exit   increase   version   int   evel   

本地python示例代码:
from selenium import webdriver
driver = webdriver.Remote(command_executor=‘http://192.168.99.10:9515‘)
driver.get(‘http://www.cnblogs.com/sherlock-merlin‘)

服务器端的chromedriver.exe启动时添加相关启动参数
chromedriver.exe --whitelisted-ips
或者
chromedriver.exe --whitelisted-ips=192.168.99.20:9515
前者接受所有连接,后者接受指定ip连接,推荐后者


参考信息:

chromedriver.exe --help

Usage: chromedriver.exe [OPTIONS]

Options
  --port=PORT                     port to listen on
  --adb-port=PORT                 adb server port
  --log-path=FILE                 write server log to file instead of stderr, increases log level to INFO
  --log-level=LEVEL               set log level: ALL, DEBUG, INFO, WARNING, SEVERE, OFF
  --verbose                       log verbosely (equivalent to --log-level=ALL)
  --silent                        log nothing (equivalent to --log-level=OFF)
  --replayable                    (experimental) log verbosely and don‘t truncate long strings so that the log can be replayed.
  --version                       print the version number and exit
  --url-base                      base URL path prefix for commands, e.g. wd/url
  --whitelisted-ips               comma-separated whitelist of remote IP addresses which are allowed to connect to ChromeDriver

python调用远程chromedriver.exe、selenium抓包方法

标签:server   path   tor   stderr   exit   increase   version   int   evel   

原文地址:https://www.cnblogs.com/sherlock-merlin/p/10115499.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!