简体   繁体   English

无法在selenium2library中按Enter

[英]Can't press enter in selenium2library

I'm trying to make a test that will open Facebook, log in and search something. 我正在尝试进行测试,以打开Facebook,登录并搜索某些内容。 However I'm having trouble getting Facebook to search. 但是我很难让Facebook搜索。 Selenium types whatever it needs in the search bar, but I can't find how to locate the search button or press the enter key. 硒可以在搜索栏中键入所需的任何类型,但是我找不到如何找到搜索按钮或按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 ***

Press Key expects two parameters - the locator, and the actual key; Press Key需要两个参数-定位器和实际键; you're calling it with only the latter. 您只用后者来称呼它。

Press Key    name=q    \\13

That should execute pressing an Enter in the search field. 该操作应在搜索字段中按Enter。

Will it work? 能行吗 I don't use FB, can't tell :) 我不使用FB,无法告诉:)

Add the html of the search button - right click on it, Inspect Element, we might be able to get a locator for it. 添加搜索按钮的html-右键单击它,检查元素,我们也许可以找到它的定位器。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 导入Selenium2Library - Importing Selenium2Library 我可以在没有安装Python的情况下为RobotFramework安装Selenium2Library吗? - Can I install Selenium2Library for RobotFramework without installing Python? Selenium2Library选择器出现问题 - Selenium2Library trouble with selectors PyCharm中的Selenium2Library代码完成 - Selenium2Library code completion in PyCharm Selenium2Library:移动鼠标位置以进行单击 - Selenium2Library: move mouse position for click 无法在 Robot Framework 中使用 Selenium2Library。 导入错误:没有名为 Selenium2Library 的模块错误 - Unable to use Selenium2Library in Robot Framework. ImportError: No module named Selenium2Library error 如何使用Selenium2Library在机器人级别向我的chromedriver添加扩展 - How can I add an extension to my chromedriver at the Robot level with Selenium2Library 如何使用 Selenium2Library 在 Robot Framework 中向我的 chromedriver 添加扩展并远程启动 - How can I add an extension to my chromedriver at the Robot Framework with Selenium2Library and launch remotely python selenium-上传图片,出现库时-不能按Enter - python selenium - uploading pic, when library appear - cant press enter RobotFramework-使用自定义库打开的浏览器无法在selenium2library中识别 - RobotFramework - Browser opened with custom library cannot be recognized in selenium2library
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM