找到使用硒(Python)的破折号下拉元素
我意识到破折号布局元素与传统的UI布局不同。我正在尝试自动化测试通常为“选择”类型的下拉元素。因此,硒语法和选择值是:
select = select(driver.find_element(By.XPATH, "...")
select.select_by_visible_text("NCS")
我得到错误:selenium.common.exceptions.unbectednectectemetagexception:消息:仅选择元素上的作品,而不是在
I realized that dash layout elements are different from the traditional UI layout. I am trying to automate testing a dropdown element which would normally be of type "select". So the selenium syntax and select th value would be:
select = select(driver.find_element(By.XPATH, "...")
select.select_by_visible_text("NCS")
I get the error: selenium.common.exceptions.UnexpectedNameTagException: Message: select only works on elements, not on
The layout for the dropdown is as follows:
Thanks for your help!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
由于未选择标签,因此您不能使用Select类选择下拉菜单。您必须找到选择的下拉菜单,然后单击将显示下拉列表的内容。然后,您可以通过提供XPath来单击所需的下拉项。
As tag is not Select, you cant use Select class for selecting dropdown. You have to find the Select dropdown and click on that which will show dropdown list. Then you can click on desired dropdown item by providing xpath.