编程新手并想出如何使用Selenium导航到我需要去的地方.我想现在解析数据,但不知道从哪里开始.有人能握住我的手一秒钟并指出我正确的方向吗?
任何帮助表示赞赏
在python中将变量[i]引入字符串中.
例如,查看以下脚本,我只想为图像命名,例如geo [0].Tiff ...到geo [i].tiff,或者如果你使用会计,因为我可以替换价值链的一部分来生成一个计数器.
data = self.cmd("r.out.gdal in=rdata out=geo.tif")
self.dataOutTIF.setValue("geo.tif")
Run Code Online (Sandbox Code Playgroud)
谢谢你的回答
我在@jdharrison上找到了关于如何RSelenium在Windows 上启动Tor的精彩答案:https:
//stackoverflow.com/a/39048970/7837376
RSelenium然而,在新版本中,startServer()它已经rsDriver()不存在了,并且它的替换不会像startServer()之前那样采用java参数.
在新的RSelenium语法中,如何在firefox中启动Tor?首先十分感谢)!
我对此进行了研究,但得到了解决方案:
from selenium import webdriver
profile = webdriver.FirefoxProfile()
profile.set_preference('network.proxy.type', 1)
profile.set_preference('network.proxy.socks', '127.0.0.1')
profile.set_preference('network.proxy.socks_port', 9050)
driver = webdriver.Firefox(profile)
driver.get('http://estoeslapollaconcebol.la')
Run Code Online (Sandbox Code Playgroud)
它给出了该错误:
无法加载个人资料。配置文件目录:C:\ Users \ HPPAV1〜1 \ AppData \ Local \ Temp \ tmppcuwx3xd Firefox输出:无
当我尝试该解决方案时。
from selenium import webdriver
from selenium.webdriver.firefox.firefox_binary import FirefoxBinary
profile=webdriver.FirefoxProfile('C:\\Users\\HP PAV 15\\Desktop\\Tor Browser\\Browser\\TorBrowser\\Data\\Browser\\profile.default\\')
binary =FirefoxBinary('C:\\Users\\HP PAV 15\\Desktop\\Tor Browser\\Browser\\firefox')
#browser = binary.launch_browser(profile)
profile.set_preference('network.proxy.type', 1)
profile.set_preference('network.proxy.socks', '127.0.0.1')
profile.set_preference('network.proxy.socks_port', 9150)
browser=webdriver.Firefox( binary, profile)
browser.get("http://yahoo.com")
browser.save_screenshot("/Users/admin/Pictures/screenshot.png")
browser.close()
Run Code Online (Sandbox Code Playgroud)
它给了我以下错误:
追溯(最近一次通话):文件“ C:/Python34/torfirstscript.py”,第10行,位于browser = webdriver.Firefox(二进制文件,配置文件)中文件“ C:\ Python34 \ lib \ site-packages \ selenium-2.43 .0-py3.4.egg \ …