我如何控制firefox(使用opt -no-remote在远程PC上启动)?

时间:2014-11-20 12:32:28

标签: python firefox selenium ssh

任务: 使用ssh登录到另一台PC并从那里启动firefox(选项-no-remote)。然后在其中做一些动作。

我使用python + selenium,但我不知道如何控制远程firefox。 有人可以帮帮我吗?

=============================================== ====================

俄语 Задача - залогинитьсянадругуюмашинуиоткрытьснееудаленныйfirefoxспараметрами-no-remote。更多信息,请访问我们的网站。

这是一个很好的选择。 Естьлиукогонибудькакие-нибудьпредложения?

UPD 21.11.14: 我在远程PC上安装了python + selenium。我移动了一些控制firefox的代码。 我查了一些例子并得到了这个例子:

def testfunc():
    cmd="python2.7 BIND.py" # Remote test
    result = commands.getoutput(cmd)

client = paramiko.SSHClient()
client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
client.connect(hostname=mil_ws, username=user, password=secret, port=portSSH)
t = client.get_transport ()  
chan = t.open_session ()  
chan.request_x11 (handler=testfunc())  
chan.set_combine_stderr (True)  
bufsize = -1  
stdin = chan.makefile('wb', bufsize)  
stdout = chan.makefile('rb', bufsize)  
stderr = chan.makefile_stderr('rb', bufsize)  
client.close()

问题是脚本在我的机器上而不是在远程上运行firefox。如果我在远程xterm上启动BIND.py - firefox正确启动。 如何通过主测试启动远程firefox?

P.S。为我糟糕的英语而烦恼

1 个答案:

答案 0 :(得分:0)

Selenium Remote Control似乎是托管远程测试会话的产品。