使用xpath查找元素未命中所需的位置元素

时间:2016-01-25 13:25:26

标签: selenium xpath

我想点击我的html文件中的单选按钮。

以下代码:

from selenium.webdriver.remote import webdriver

element = webdriver.WebDriver.find_element_by_xpath("//input[@type='radio' and @name='AlarmMode']")
element.click()

给我错误:

TypeError: find_element_by_xpath() missing 1 required positional argument: 'xpath'

缺少哪个参数?

1 个答案:

答案 0 :(得分:3)

您需要首先实例化set(CMAKE_RUNTIME_OUTPUT_DIRECTORY bin) # Executables will be generated under bin/ add_subdirectory(sub1) # Build an executable file called exec1 add_subdirectory(sub2) # Build an executable file called exec2 add_custom_target(exec_all COMMAND /bin/sh -c ${CMAKE_SOURCE_DIR}/run.sh exec1 exec2 WORKING_DIRECTORY ${CMAKE_BINARY_DIR} ) 对象,然后在其上调用webdriver

find_element_by_xpath()