相关疑难解决方法(0)

用selenium打开浏览器

是否有可能使硒使用TOR浏览器?有没有人有任何可以复制粘贴的代码?

python selenium tor

25
推荐指数
5
解决办法
3万
查看次数

在Linux/Windows中使用RSelenium的Tor浏览器

希望使用我的Linux机器使用RSelenium和Tor来返回Tor IP(将Firefox作为Tor浏览器).这对于Python是可行的,但在R中遇到问题.任何人都可以使用它吗?也许您可以在Windows/Linux中共享您的解决方案.

# library(devtools)
# devtools::install_github("ropensci/RSelenium")
library(RSelenium)

RSelenium::checkForServer()
RSelenium::startServer() 

binaryExtension <- paste0(Sys.getenv('HOME'),"/Desktop/tor-browser_en-US/Browser/firefox")
remDr <- remoteDriver(dir = binaryExtention)

remDr$open()
remDr$navigate("http://myexternalip.com/raw")
remDr$quit()
Run Code Online (Sandbox Code Playgroud)

Error in callSuper(...) : object 'binaryExtention' not found正在返回错误.

对于社区参考,此Selenium代码在Windows中使用Python3:

from bs4 import BeautifulSoup
from selenium import webdriver
from selenium.webdriver.firefox.firefox_profile import FirefoxProfile
from selenium.webdriver.firefox.firefox_binary import FirefoxBinary

from os.path import expanduser # Finds user's user name on Windows

# Substring inserted to overcome r requirement in FirefoxBinary 
binary = FirefoxBinary(r"%s\\Desktop\\Tor Browser\\Browser\\firefox.exe"  % (expanduser("~")))
profile = FirefoxProfile(r"%s\\Desktop\\Tor Browser\\Browser\\TorBrowser\\Data\\Browser\\profile.default" % (expanduser("~")))

driver = …
Run Code Online (Sandbox Code Playgroud)

python selenium r tor rselenium

3
推荐指数
1
解决办法
1021
查看次数

标签 统计

python ×2

selenium ×2

tor ×2

r ×1

rselenium ×1