0

我运行了以下内容:

C:\Program Files\Mozilla Firefox>firefox -marionette

Firefox 启动,命令行再次可供我使用。没有回应:

… 1491228343089 Marionette INFO 监听端口 2828

如此处所述

当我使用 python 运行木偶时,我执行以下命令:

from marionette_driver.marionette import Marionette
client = Marionette('localhost',port=2828)
client.start_session()

回来:

---------------------------------------------------------------------------
timeout                                   Traceback (most recent call last)
<ipython-input-4-383639021ded> in <module>()
----> 1 client.start_session()

C:\Users\%USER%\AppData\Local\conda\conda\envs\realestate27\lib\site-packages\marionette_driver\decorators.pyc in _(*args, **kwargs)
     26             # application, make sure to handle those correctly.
     27             m = _find_marionette_in_args(*args, **kwargs)
---> 28             m._handle_socket_failure()
     29 
     30     return _

C:\Users\%USER%\AppData\Local\conda\conda\envs\realestate27\lib\site-packages\marionette_driver\decorators.pyc in _(*args, **kwargs)
     21     def _(*args, **kwargs):
     22         try:
---> 23             return func(*args, **kwargs)
     24         except (socket.error, socket.timeout):
     25             # In case of socket failures which will also include crashes of the

C:\Users\%USER%\AppData\Local\conda\conda\envs\realestate27\lib\site-packages\marionette_driver\marionette.pyc in start_session(self, capabilities, timeout)
   1210             # In the case when Marionette doesn't manage the binary wait until
   1211             # its server component has been started.
-> 1212             self.raise_for_port(timeout=timeout)
   1213 
   1214         self.client = transport.TcpTransport(

C:\Users\%USER%\AppData\Local\conda\conda\envs\realestate27\lib\site-packages\marionette_driver\marionette.pyc in raise_for_port(self, timeout)
    708         if not connected:
    709             raise socket.timeout("Timed out waiting for connection on {0}:{1}!".format(
--> 710                 self.host, self.port))
    711 
    712     @do_process_check

timeout: Timed out waiting for connection on localhost:2828!

有没有其他人经历过这个?我究竟做错了什么?

4

1 回答 1

0

您可能已经运行了一个 firefox 实例,这就是为什么当您启动 firefox 时,它会在已运行的实例中打开一个新窗口。您需要做的是从另一个配置文件启动一个新实例或退出 firefox,然后使用 marionette 选项打开它。

如果要创建新配置文件,可以运行以下命令,然后配置文件管理器启动,您可以在其中创建新配置文件。

firefox --new-instance -ProfileManager

然后使用 marionett 选项启动 Firefox。

firefox --new-instance -P <NAME_OF_THE_NEW_PROFILE> -marionette
于 2019-02-27T22:12:19.020 回答