Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/selenium/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
“如何修复”;“不存在的设置”;来自robotframework和seleniumlibrary的错误?_Selenium_Testing_Automated Tests_Robotframework - Fatal编程技术网

“如何修复”;“不存在的设置”;来自robotframework和seleniumlibrary的错误?

“如何修复”;“不存在的设置”;来自robotframework和seleniumlibrary的错误?,selenium,testing,automated-tests,robotframework,Selenium,Testing,Automated Tests,Robotframework,我正在尝试运行一个脚本来搜索关键字“mdh”,并显示mdh.se作为结果。 我安装了robot框架和selenium库,这是我用sublime文本编写的脚本,并保存为.robot文件 *** Settings *** Library Selenium2Library Suite Setup Go to homepage Suite Teardown Close All Browsers *** Variables *** ${HOMEPAGE} http://www.google.com ${

我正在尝试运行一个脚本来搜索关键字“mdh”,并显示mdh.se作为结果。 我安装了robot框架和selenium库,这是我用sublime文本编写的脚本,并保存为.robot文件

*** Settings ***
Library Selenium2Library
Suite Setup Go to homepage
Suite Teardown Close All Browsers

*** Variables ***
${HOMEPAGE} http://www.google.com
${BROWSER} chrome

*** Test Cases ***
Google mdh and find mdh
Google and check results mdh www.mdh.se

*** Keywords ***
Google and check results
[Arguments] ${searchkey} ${result}
Input Text class_name=gLFyf gsfi ${searchkey}
Click Button class_name=Tg7LZd
Wait Until Page Contains ${result}
Go to homepage
Open Browser ${HOMEPAGE} ${BROWSER}
当我尝试使用robot mdh.robot运行脚本时,它显示有5个错误

C:\Users\malvi\Desktop>robot mdh.robot

[ ERROR ] Error in file 'C:\Users\malvi\Desktop\mdh.robot': Non-existing setting 'Library 
Selenium2Library'.

[ ERROR ] Error in file 'C:\Users\malvi\Desktop\mdh.robot': Non-existing setting 'Suite Setup Go to 
homepage'.

[ ERROR ] Error in file 'C:\Users\malvi\Desktop\mdh.robot': Non-existing setting 'Suite Teardown 
Close All Browsers'.

[ ERROR ] Error in file 'C:\Users\malvi\Desktop\mdh.robot': Setting variable '${HOMEPAGE} 
http://www.google.com' failed: Invalid variable name '${HOMEPAGE} http://www.google.com'.

[ ERROR ] Error in file 'C:\Users\malvi\Desktop\mdh.robot': Setting variable '${BROWSER} chrome' 
failed: Invalid variable name '${BROWSER} chrome'.

我做错什么了吗?

仔细阅读错误消息,并从字面上理解它。这是说没有名为“套件设置”的设置转到主页,这是一个正确的说法。但是,有一个名为
套件设置
的设置


设置名称和设置值之间至少需要两个空格。

谢谢,我终于找到了答案。现在我遇到了另一个问题,我需要搜索一些东西,但搜索字段没有名称或id。您知道如何使用Xpath来实现这一点吗?我复制了xpath,但不知道如何在上面的代码中编写它example@MalvinaLatifaj:如果答案解决了您的问题,请将其标记为已接受答案。请阅读文档: