Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/300.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

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
Python Selenium2库选择器出现故障_Python_Selenium_Selector_Selenium2library - Fatal编程技术网

Python Selenium2库选择器出现故障

Python Selenium2库选择器出现故障,python,selenium,selector,selenium2library,Python,Selenium,Selector,Selenium2library,我正在使用Selenium2库进行一些测试,但我在使用元素选择器时遇到了一些问题。 我试过很多。有许多不同的方法,但似乎都不起作用。我想做的是测试登录/注册的功能,但我就是找不到正确的方法 *** Settings *** Documentation This is some basic info Library Selenium2Library *** Variables *** *** Keywords *** *** Test Cases *** Check log in and

我正在使用Selenium2库进行一些测试,但我在使用元素选择器时遇到了一些问题。 我试过很多。有许多不同的方法,但似乎都不起作用。我想做的是测试登录/注册的功能,但我就是找不到正确的方法

*** Settings ***
Documentation  This is some basic info
Library  Selenium2Library
*** Variables ***

*** Keywords ***

*** Test Cases ***
Check log in and register

    open browser  http://www.999.md
    set browser implicit wait  5
    click element  css=div.user-login-btn
这是我经常遇到的错误:

ValueError:元素定位器“css=div.user-login-btn”与任何元素都不匹配


您的
CSS
选择器打算匹配
,但目标元素实际上是
,所以您需要的是

css=div#user-login-btn

请注意,
CSS
选择器中的
代表属性选择器,而
“#”
-代表属性选择器,您的
CSS
选择器打算匹配
,但目标元素实际上是
,所以您需要的是

css=div#user-login-btn

请注意,
CSS中的
选择器代表属性选择器,而
中的“#”
-对于属性选择器

@Andresson,我已经尝试过了,但它也不起作用。我得到了相同的错误。这是因为按钮位于带有
id=“topbar panel”
iframe
内。您需要切换到该
iframe
才能处理button@Andresson我不知道,我还是个新手。我该怎么做?谷歌搜索了一段时间后,a只能在web驱动程序中找到这个,而不是在selenium2library中。不幸的是,我对selenium2library的语法一点也不熟悉…@Andresson我试过了,它也不起作用。我得到了相同的错误。这是因为按钮位于带有
id=“topbar panel”
iframe
内。您需要切换到该
iframe
才能处理button@Andresson我不知道,我还是个新手。我该怎么做?通过谷歌搜索,a只能在web驱动程序中找到它,而不是在selenium2library中。不幸的是,我根本不熟悉
selenium2library
语法…@Pri也不起作用。@Pri也不起作用。