如何在 div 中同时使用 id 和 class 在 selenium python 中查找元素,然后单击它:
<div id="abc" class="xyz" style="" role="presentation"></div>
Run Code Online (Sandbox Code Playgroud)
我正在使用以下代码:
arrow = driver.find_element_by_xpath('//div[@id="abc"][@class="xyz"]')
arrow.click()
Run Code Online (Sandbox Code Playgroud)
但我收到错误如下:
NoSuchElementException: Message: Unable to locate element: {"method":"xpath","selector":"//div[@id=\"abc\"][@class=\"xyz\"]"}
Run Code Online (Sandbox Code Playgroud) 我有以下程序:
proc show_information {args} {
set mandatory_args {
-tftp_server
-device ANY
-interface ANY
}
set optional_args {
-vlan ANY
}
parse_dashed_args -args $args -optional_args $optional_args -mandatory_args $mandatory_args
log -info "Logged in device is: $device"
log -info "Executing proc to get all data"
set commands {
"show mpls ldp neighbor"
"show mpls discovery vpn"
"show mpls interface"
"show mpls ip binding"
"show running-config"
"show policy-map interface $intr vlan $vlan input"
"show run interface $intr
}
foreach command $commands {
set show …Run Code Online (Sandbox Code Playgroud)