小编W3Q*_*W3Q的帖子

如何修复Selenium WebDriverException:在我们连接之前,浏览器似乎已经退出了?

我已经在我的centos6.4服务器上安装了firefox和Xvfb来使用selenium webdriver.

但是,当我运行代码时,我收到了一个错误.

from selenium import webdriver
browser = webdriver.Firefox()
Run Code Online (Sandbox Code Playgroud)

错误

selenium.common.exceptions.WebDriverException: Message: 
'The browser appears to have exited before we could connect. The output was: None'
Run Code Online (Sandbox Code Playgroud)

我在stackoverflow上读了一些相关的页面,有人建议删除tmp文件夹中的所有文件,所以我做到了.但是,它仍然无效.

有人可以帮我一个忙吗?

先感谢您!

编辑

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.4/site-packages/selenium/webdriver/firefox/webdriver.py", line 59, in __init__
    self.binary, timeout),
  File "/usr/local/lib/python3.4/site-packages/selenium/webdriver/firefox/extension_connection.py", line 47, in __init__
    self.binary.launch_browser(self.profile)
  File "/usr/local/lib/python3.4/site-packages/selenium/webdriver/firefox/firefox_binary.py", line 64, in launch_browser
    self._wait_until_connectable()
  File "/usr/local/lib/python3.4/site-packages/selenium/webdriver/firefox/firefox_binary.py", line 103, in _wait_until_connectable
    self._get_firefox_output())
selenium.common.exceptions.WebDriverException: Message: 'The browser appears to have exited     before …
Run Code Online (Sandbox Code Playgroud)

python selenium webdriver selenium-webdriver

60
推荐指数
6
解决办法
7万
查看次数

在HTML5中的页脚标记中是否可以使用节标记?

我是HTML5标记的新手.

我想知道我是否允许在页脚中有一个部分标签,如下所示.

<article>
    <header class="content__header">
    </header>

    <section class="content__body">
    </section>

    <footer class="content__footer>
        <section class="relatedArticles">
        </section>
        <section class="pagination">
        </section>
    </footer>

</article>
Run Code Online (Sandbox Code Playgroud)

w3c文档没有解释有关页脚标记的使用情况.

谢谢!!

html html5

4
推荐指数
1
解决办法
2789
查看次数

无法从内容脚本调用 chrome.alarms.create()

我现在正在开发一个 Chrome 扩展程序。

我的问题是,当我调用 时chrome.alarms.create(),出现以下错误:

Uncaught TypeError: Cannot read property 'create' of undefined 
Run Code Online (Sandbox Code Playgroud)

我的扩展包中有这些文件:

清单.json

{   
    "manifest_version": 2,
    "name": "Tool",
    "version": "1.0",
    "background": {
        "scripts": ["background.js"]
    },
    "permissions": ["background", "tabs", "webNavigation", "alarms"]
}
Run Code Online (Sandbox Code Playgroud)

myscript.js

chrome.alarms.create("aaa", {"when":Date.now()+5000});

chrome.alarms.onAlarm.addListener(function(alarm){
  console.log("hello");
});
Run Code Online (Sandbox Code Playgroud)

背景.js

chrome.pageAction.onClicked.addListener(function(tab) {
    chrome.tabs.executeScript(null, {file: "myscript.js"});
});
Run Code Online (Sandbox Code Playgroud)

当我打电话时chrome.alarms.create()background.js它工作正常。但是,当我调用 中的函数时myscript.js,它会导致错误。

原因是什么以及如何解决这个问题?

javascript jquery google-chrome google-chrome-extension

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

是否可以安排启动Chrome应用并定期运行某些命令?

我今天开发了一些Chrome应用和Chrome扩展程序以获得乐趣.

我想知道我是否可以安排启动Chrome应用程序并定期运行某些命令,如cron作业.

我知道Chrome会提供"chrome.alarm api"来定期运行某个功能,但我相信它需要用户保持我的Chrome应用程序处于打开状态,或者保持我的chrome扩展程序安装到的Chrome浏览器打开.

请告诉我,如果我能在第一时间做这样的事情,如果我能做到,请告诉我如何才能做到这一点!

javascript google-chrome google-chrome-extension google-chrome-app

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

Chrome App API 中 webview 标签的分区属性是什么?

我现在正在开发一个 Google Chrome 打包应用程序。

我将使用 webview 标签来嵌入我正在开发的这个应用程序的网页。

我正在阅读下面描述 webview 标签的文档。

https://developer.chrome.com/apps/tags/webview

但是,我不太明白这是做什么用的。

谁能解释一下分区属性的用途吗?

谢谢!

<webview id="foo" src="http://www.google.com/" style="width:640px; height:480px" partition="persist:googlepluswidgets"></webview>
Run Code Online (Sandbox Code Playgroud)

webview标签使用的存储分区ID。如果存储分区 ID 以 persist: (partition="persist:googlepluswidgets") 开头,则 webview 将使用应用程序中具有相同存储分区 ID 的所有来宾可用的持久存储分区。如果未设置 ID 或者没有 'persist': 前缀,则 webview 将使用内存中的存储分区。该值只能在第一次导航之前修改,因为活动渲染器进程的存储分区无法更改。后续尝试修改该值将失败并出现 DOM 异常。通过分配相同的分区ID,多个webview可以共享同一个存储分区。

javascript google-chrome webview google-chrome-extension google-chrome-app

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