无法在selenium2library中按Enter [英] Can't press enter in selenium2library

查看:298
本文介绍了无法在selenium2library中按Enter的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试进行一项测试,该测试将打开Facebook,登录并搜索某些内容.但是,我很难让Facebook进行搜索.硒可以在搜索栏中键入所需的任何类型,但是我找不到如何找到搜索按钮或按Enter键的方式.

I'm trying to make a test that will open Facebook, log in and search something. However I'm having trouble getting Facebook to search. 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.

*** 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需要两个参数-定位符和实际键;您只用后者来称呼它.

Press Key expects two parameters - the locator, and the actual key; you're calling it with only the latter.

Press Key    name=q    \\13

该操作应在搜索字段中按Enter键.

That should execute pressing an Enter in the search field.

它将起作用吗?我不使用FB,无法告诉:)

Will it work? I don't use FB, can't tell :)

添加搜索按钮的html-右键单击检查元素",我们也许可以为其找到一个定位器.

Add the html of the search button - right click on it, Inspect Element, we might be able to get a locator for it.

这篇关于无法在selenium2library中按Enter的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆