2017-05-04 45 views
-2

我试图做一个测试,将打开Facebook,登录和搜索的东西。不过,我无法让Facebook搜索。 Selenium在搜索栏中键入所需内容,但我无法找到如何定位搜索按钮或按Enter键。无法在硒库中按输入

*** Settings *** 
Documentation Tell pui she bitch 
Library Selenium2Library 

*** Variables *** 

*** Test Cases *** 
User must tell pui she bitch 
    open browser http://www.facebook.com 
    set browser implicit wait 5 
    input text name=email ***** 
    input text name=pass **** 
    click button id=u_0_q 
    input text name=q ***** 
    press key \\13 


    close browser 


*** Keywords *** 

回答

1

Press Key需要两个参数 - 的定位器,和实际密钥;你只用后者来调用它。

Press Key name=q \\13 

这应该执行在搜索字段中按Enter键。

它会工作吗?我不使用FB,不能说:)

添加搜索按钮的html - 右键单击​​它,检查元素,我们可能能够得到它的定位器。

+0

谢谢,我已经做了你的建议。将尝试按键,看看它是否工作。 –