首页 > 编程语言 > 详细

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

时间:2018-12-13 18:39:36      阅读:317      评论:0      收藏:0      [点我收藏+]
本地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抓包方法

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

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!