Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/294.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 无法在Selenium中打开磁盘上的文件_Python_Selenium - Fatal编程技术网

Python 无法在Selenium中打开磁盘上的文件

Python 无法在Selenium中打开磁盘上的文件,python,selenium,Python,Selenium,我有一个html文件存储在磁盘上。我想用Selenium打开它。但这段代码引发了一个异常: driver.get("file:///home/me123/file1.html") firefox驱动程序的错误: File "/usr/lib/python3.4/socket.py", line 503, in create_connection sock.connect(sa) ConnectionRefusedError: [Errno 111] Connection refused

我有一个html文件存储在磁盘上。我想用Selenium打开它。但这段代码引发了一个异常:

driver.get("file:///home/me123/file1.html")
firefox驱动程序的错误:

File "/usr/lib/python3.4/socket.py", line 503, in create_connection
    sock.connect(sa)
ConnectionRefusedError: [Errno 111] Connection refused

嗯,对我有用。使用ChromeWebDriver。你能发布你的完整代码吗?嗯,对我有用。使用ChromeWebDriver。你能发布你的完整代码吗?