selenium - Python Selenium - 无法单击具有 HTML 标记 i 类的 UI 元素
问题描述
所有带有 HTML 标签“ i class
”的 UI 元素都没有被点击
下面是我试图点击的元素的 HTML:
<button class="btn btn-icon btn-transparent undefined" eventkey="1"><i class="fa fa-bolt hx-primary inline-actions-overview" title="Test this"></i></button>
我用 css 和 xpaths 尝试了以下各种方法,但似乎没有任何效果:
1.) self.driver.find_element(By.CSS_SELECTOR, '.fa-bolt').click()
2.) ActionChains(self.driver.get_driver()).move_to_element(element).send_keys(Keys.ENTER).perform()
3.) ActionChains(self.driver.get_driver()).move_to_element(element).double_click(element).perform()
4.) self.driver.execute_script("arguments[0].click();", element)
任何帮助表示赞赏!
注意:我需要单击的元素来自以下 HTML:
<i class="fa fa-bolt hx-primary inline-actions-overview" title="Test this"></i>
解决方案
推荐阅读
- c# - C# SQLite 从 DB 中获取真正的价值会生成 Invalid Cast Exception
- javascript - Firefox 控制台无法定义变量
- python - VGG 输入未定义
- java - Spring 单元测试:使用 @SpyBean 模拟 void 方法:获取该 bean 的 NullPointerException,除非我使用 @Mock
- django - /users/profile/ 中的 TemplateDoesNotExist
- bash - 如何从 df 命令获取挂载磁盘的名称
- html - Bootstrap 4导航栏搜索框未在中心对齐
- angular - 使用 Router Guards 重定向用户
- php - 如何配置 knp_snappy 包以生成不同的页面格式
- r - 如何在非交互式调用中获取 getParseData 的结果?