我想动态添加类名,您能帮我吗...
我正在将python3与硒吨废料一起使用...
new = "dt du dv bs dw dx dy dz aw ea ag b ah ai eb ak ec ed j dl ee az "
browser.find_element_by_xpath(".//button[@class='"+new+"']).click()
结果:它应该导航到Web并单击按钮
error:
browser.find_element_by_xpath(".//button[@class='"+new+"']").click()
File "/home/venky/.local/lib/python3.5/site-packages/selenium/webdriver/remote/webdriver.py", line 394, in find_element_by_xpath
return self.find_element(by=By.XPATH, value=xpath)
File "/home/venky/.local/lib/python3.5/site-packages/selenium/webdriver/remote/webdriver.py", line 978, in find_element
'value': value})['value']
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"xpath","selector":".//button[@class='dt du dv bs dw dx dy dz aw ea ag b ah ai eb ak ec ed j dl ee az ']"}
(Session info: chrome=73.0.3683.103)
(Driver info: chromedriver=73.0.3683.68 (47787ec04b6e38e22703e856e101e840b65afe72),platform=Linux 4.10.0-28-generic x86_64)