2016-12-14 21 views
0

我的脚本曾经工作,但突然它已停止工作。
我已经将Selenium更新到最新版本(3.0.2),并且我正在使用最新版本的ChromeDriver(2.26)。在Windows上使用Selenium与ChromeDriver - 错误:“无法创建锁定文件”

这里的,我认为是造成该问题的代码的摘录:

options = webdriver.ChromeOptions() 
options.add_argument("user-data-dir=C:¥Users¥username¥AppData¥Local¥Google¥Chrome¥User Data¥Profile 1") 

代码看起来没什么问题的,所以我怀疑它可能是谷歌Chrome的问题,而不是硒之一。我没有铬配置文件选项(即默认配置文件)的其他完全相同的脚本完美。

这是我收到错误消息:

[7256:21580:1214/033134:ERROR:process_singleton_win.cc(340)] Lock file can not be created! Error code: 32 
[7256:21580:1214/033134:ERROR:chrome_browser_main.cc(1703)] Failed to create a ProcessSingleton for your profile directory. This means that running multiple instances would start multiple browser processes rather than opening a new window in the existing process. Aborting now to avoid profile corruption. 

任何帮助将非常感激。

回答

0

这可能是由于某些zombie Chrome实例锁定了“user-data-dir”参数中指定的配置文件。中途强行停止硒往往会让他们落后。

尝试前往指定的配置文件目录并删除名为“lockfile”的文件。如果操作系统抱怨文件正在使用中,请关闭所有可见的Chrome实例,并检查(通过任务管理器)是否有僵尸Chrome实例并尝试全部杀死它们。

相关问题