【问题标题】:how to click in this element by python selenuim如何通过 python selenium 点击这个元素
【发布时间】:2022-01-17 09:29:50
【问题描述】:

我如何点击这个元素我有很多具有角色 = 按钮和类名以及可触摸的元素

<a role="button" class="_56bz _54k8 _5c9u _5caa" data-store="{&quot;log_data&quot;:{&quot;page_id&quot;:10965642141242,&quot;source&quot;:null,&quot;referrer&quot;:null,&quot;platform&quot;:&quot;mtouch&quot;},&quot;event_name&quot;:&quot;tapped_more_button&quot;,&quot;module_name&quot;:&quot;pages_public_view&quot;}" aria-label="" data-sigil="touchable"><i class="_5c9v _56br _4q9b img sp_l-Rkd1MGdk7 sx_0acc7f"></i><span class="_55sr">المزيد</span></a>

【问题讨论】:

  • 这段文字المزيد怎么样?
  • 检查 //a[./span[.='المزيد']] 在开发者控制台中是否有效。
  • 请澄清您的具体问题或提供更多详细信息以准确突出您的需求。正如目前所写的那样,很难准确地说出你在问什么。

标签: python python-3.x selenium selenium-webdriver


【解决方案1】:

在 chrome 开发工具中,您可以选择元素并选择“复制为 xpath”,它将提供一个独特的选择器。

【讨论】:

  • 我有这个 xpath 如何写它//*[@id="action_bar"]/div[4]/a
  • driver.find_element_by_xpath()
  • 我的意思是怎么写在()中
  • driver.find_element_by_xpath('//*[@id="action_bar"]/div[4]/a')
  • 我尝试通过 xpath 复制此元素但没有成功,为什么?他的xpath是//*[@id="u_0_j_Ac"],所有元素都是&lt;div class="_59k _2rgt _1j-f _2rgt" style="font-size: 17px;font-weight: 500;line-height: 20px;text-align: right;color: #050505" id="u_0_j_Ac" aria-label="عام" role="button" tabindex="0" data-nt="FB:TEXT4"&gt;عام&lt;/div&gt;
猜你喜欢
  • 2019-06-09
  • 1970-01-01
  • 2019-05-10
  • 1970-01-01
  • 2020-04-09
  • 1970-01-01
  • 2020-04-28
  • 1970-01-01
  • 2018-08-16
相关资源
最近更新 更多