我在RobotFram中创建了此脚本
*** Settings ***
Documentation This is a basic test for Linkedin Login
Library Selenium2Library
*** Variables ***
${Browser} chrome
${SiteUrl} https://www.linkedin.com/
${username} xpath=//*[@id="login-email"]
${psw} xpath=//*[@id="login-password"]
${sigin} xpath=//*[@id="login-submit"]
*** Test Cases ***
Login Page
open browser ${SiteUrl} ${Browser}
Input Text ${username} nouser@test.com
sleep 30 sec
Input Text ${psw} nopsw
click button ${sigin}
close browser
我在“电子邮件”和“密码”字段中插入邮件和密码时遇到问题。
该报告给了我这个错误:
KEYWORD Selenium2Library . Input Text ${username} nouser@test.com
说明文件:
在由
text
标识的文本字段中键入给定的locator
。Start / End / Elapsed: 20190311 21:59:48.408 / 20190311 21:59:48.408 / 00:00:00.000 21:59:48.408 FAIL Keyword 'Selenium2Library.Input Text' expected 2 arguments, got 1.
最佳答案
该错误说明了自己:
FAIL Keyword 'Selenium2Library.Input Text' expected 2 arguments, got 1.
该命令期望有两个参数,但只有一个,原因是您在args之间仅使用一个空格,它们之间至少需要两个或多个空格。
所以这:
Input Text ${username} nouser@test.com
应该是这样的:
Input Text ${username} nouser@test.com
就像:
open browser ${SiteUrl} ${Browser}
关于error-handling - 使用robotframework在登录脚本中添加电子邮件和密码,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55109756/