Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/selenium/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/image-processing/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 3.x 带有奇怪字符的Python撬动路径_Python 3.x_Selenium_Path - Fatal编程技术网

Python 3.x 带有奇怪字符的Python撬动路径

Python 3.x 带有奇怪字符的Python撬动路径,python-3.x,selenium,path,Python 3.x,Selenium,Path,我正在使用一个与Python3.4和selenium库一起运行的脚本,我得到了这个错误 PhantomJS with Selenium错误:消息:“PhantomJS”可执行文件需要 行路 这里有一个解决方案 但是当我尝试实现该解决方案时,C:\DriverPath\Bin\的路径被错误地引入,当我打印包含它的属性(self.path)时,它会打印 用那个点代替C:\DriverPath\Bin\并不断触发“PhantomJS with Selenium错误:消息:'PhantomJS'可执

我正在使用一个与Python3.4和selenium库一起运行的脚本,我得到了这个错误

PhantomJS with Selenium错误:消息:“PhantomJS”可执行文件需要 行路

这里有一个解决方案

但是当我尝试实现该解决方案时,C:\DriverPath\Bin\的路径被错误地引入,当我打印包含它的属性(self.path)时,它会打印


用那个点代替C:\DriverPath\Bin\并不断触发“PhantomJS with Selenium错误:消息:'PhantomJS'可执行文件需要在路径中”。你知道Selenium 3.4.3和PhantomJS 2.1.1与Python 3.6.1一起使用会是什么吗?以下代码行初始化PhantomJS驱动程序perfecto:

driver = webdriver.PhantomJS(executable_path="C:\\Utility\\phantomjs-2.1.1-windows\\bin\\phantomjs.exe")
driver.get("https://www.booking.com/")

如果这回答了您的问题,请告诉我。

我想这是window的渲染方式
\b
。在python中设置路径时,要么转义反斜杠(即
“C:\\DriverPath\\Bin\\”
),要么使用原始字符串(即
r“C:\DriverPath\Bin\”
)。