我将 geckodriver 与 python selenium 一起使用。简单的命令driver = Webdriver.Firefox()
,挂起python脚本。我调试并发现它是 geckodriver 没有响应。手动启动 geckodriver 并且 curl 也没有响应。但是 firefox 实例已启动并准备就绪,但 geckodriver 没有发送任何 HTTP 响应。关于如何进一步调试的任何想法?即使它需要对 geckodriver 进行任何修补,我也想尝试。
$ geckodriver --port 57738 &> gecko.log &
[1] 16123
$ jobs
[1] + running geckodriver --port 57738 &> gecko.log
$ curl -v --data '{"requiredCapabilities": {}, "desiredCapabilities": {"javascriptEnabled": true, "browserName": "firefox", "version": "", "platform": "ANY", "marionette": true}}' http://127.0.0.1:57738/session
* Hostname was NOT found in DNS cache
* Trying 127.0.0.1...
* Connected to 127.0.0.1 (127.0.0.1) port 57738 (#0)
> POST /session HTTP/1.1
> User-Agent: curl/7.35.0
> Host: 127.0.0.1:57738
> Accept: */*
> Content-Length: 160
> Content-Type: application/x-www-form-urlencoded
>
* upload completely sent off: 160 out of 160 bytes
壁虎日志
$ cat gecko.log
1479507861533 geckodriver INFO Listening on 127.0.0.1:57738
1479507874758 mozprofile::profile INFO Using profile path /tmp/rust_mozprofile.fkk6AqrNIGxB
1479507874759 geckodriver::marionette INFO Starting browser /usr/bin/firefox
1479507874763 geckodriver::marionette INFO Connecting to Marionette on localhost:36577
+ exec /usr/bin/firefox.real --marionette --profile /tmp/rust_mozprofile.fkk6AqrNIGxB
(firefox:16144): GLib-GObject-CRITICAL **: g_object_ref: assertion 'object->ref_count > 0' failed
(firefox:16144): GLib-GObject-CRITICAL **: g_object_unref: assertion 'object->ref_count > 0' failed
(firefox:16144): GLib-GObject-CRITICAL **: g_object_ref: assertion 'object->ref_count > 0' failed
(firefox:16144): GLib-GObject-CRITICAL **: g_object_unref: assertion 'object->ref_count > 0' failed
1479507875413 Marionette INFO Listening on port 36577