【发布时间】:2018-09-17 21:33:56
【问题描述】:
【问题讨论】:
-
分享你的代码
-
你将不得不重新回答这个问题。
标签: python html selenium element whatsapp
【问题讨论】:
标签: python html selenium element whatsapp
使用 XPath
//div[contains(@class,'_31LzD')]/div[text()='You can't join this group because it is full']
//div[contains(@class,'_3QNwO')]//precding::div[text()='You can't join this group because it is full']
【讨论】:
假设类名不变,你可以使用:
browser.find_elements_by_xpath("//div[contains(@class,'_31LzD')]/div")
如果类确实发生了变化,你总是可以从像.copyable-area这样的“固定”元素开始工作:
browser.find_elements_by_xpath("//div[contains(@class,'copyable-area')]/div/div/div/div/div")
如果知道文本本身不会改变,可以根据文本内容查询:
driver.find_elements_by_xpath("//div[contains(text(), 'You can't join this group because it is full')]")
【讨论】: