我正在尝试使用Python向联系人发送whatsapp消息,但收到错误:InvalidSelectorException: Message: invalid selector: Unable to locate an element with the xpath expression //span[@title = "Me Postpaid"]"} (Session info: chrome=73.0.3683.103) (Driver info: chromedriver=73.0.3683.68 (47787ec04b6e38e22703e856e101e
试图让selenium选中python的一个复选框,但它似乎一直在超时。
当前代码是
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
driver = webdriver.Chrome()
driver.get('https://grabagu
我的目标是在包含特定文本的网页中找到所有的HREF链接。使用Chrome DevTools,我在“查找元素”中进行了测试:
[href*='photo/?fbid']
而且它工作得很好,因为它把它们都还回来了。
当我试图将它包含在robotframework脚本中时:
${elements}= Get WebElements xpath://[href*='photo/?fbid']
FOR ${element} IN @{elements}
Log ${element.text}
我一直在使用这段代码向一组whatsApp用户发送多条消息,并且已经运行了一段时间。但它最近停止了工作。
在发送消息之前,我收到了这个错误消息。selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"xpath","selector":"//*[@id="main"]/footer/div[1]/div[2]/div/div[2]"}
我想要更新
<tr id="GBPUSD" class="filled" title="Great Britain Pound vs US Dollar
Calculation: Forex
Trade: Full access" draggable="true" style="background: rgb(255, 255, 255);"><td
id="symbol" class="symbol"><div class="container"
我使用这个xpath代码向各个whatsApp用户发送自动消息,以单击send按钮。navegador.find_element_by_xpath('//*[@id="main"]/footer/div[1]/div[2]/div/div[2]').send_keys(Keys.SEND)
它最近停止工作,说它找不到xpath。selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method"
我正在尝试使用selenium根据调用函数时传递给它的变量来定位和选择某个元素。我认为有了一个好的ol,这就足够简单了:
show = browser.find_element_by_xpath("//*[contains(text(), '%s')]" % eventName)
但是,我收到错误:
selenium.common.exceptions.InvalidSelectorException: Message: invalid selector: Unable to locate an element with the xpath expression
我有一个特定的XPath查询,用于从某个Helper中获取高度,当我通过XPath帮助插件在Chrome中执行它时,它会完美地返回我想要的值。
//*/div[@class="BarChart"]/*[name()="svg"]/*[name()="svg"]/*[name()="g"]/*[name()="rect" and @class="bar bar1"]/@height
但是,当我通过机器人框架中的Get元素属性-关键字使用相同的查询时
Get Element Attribute//*/d
我在我的机器人框架脚本中遇到了下面的错误。
InvalidSelectorException: Message: invalid selector: Unable to locate an element with the xpath expression //ul[@id='xyz-ul']/li[contains(text(),'Épargne en vue d\'un objectif précis')] because of the following error:
SyntaxError: Failed to execute 'eval
如果XPath包含法语特殊字符(èd'),则它似乎无法工作,因此出现以下错误
InvalidSelectorException: Message: invalid selector: Unable to locate an element with the xpath expression
//*[@class='v-menubar-menuitem']/*[contains(text(), 'Afficher la bibliothèque d'autorisations')]
because of the following error:
我已经创建了一个浏览器抓取脚本,它使用python在WhatsApp web上发送消息,但昨天注意到它正在发送半条消息或不发送消息。已对其进行调试,发现浏览器窗口必须处于活动状态才能发送消息,发送消息代码如下。
def send_message(msg):
whatsapp_msg = driver.find_element_by_class_name(send_messageClass)
for part in msg.split('\n'):
whatsapp_msg.send_keys(part)
ActionChains(
在法语中运行机器人测试用例时出现以下错误,但它在英语中运行相同的测试用例
InvalidSelectorException: Message: invalid selector: Unable to locate an element with the xpath expression //span[contains(@class, 'v-button-caption')and text()=Options de sélection] because of the following error:
SyntaxError: Failed to execute 'eval
Error message : selenium.common.exceptions.InvalidSelectorException: Message: Given css selector expression ". clickable event-link math " is invalid: InvalidSelectorError: Document.querySelector: '. clickable event-link math ' is not a valid selector: ". clickable event-link mat
在机器人框架中,我试图检查源代码中是否存在"XXX“,如下所示:
<button class='btn-aaa'>
<span class='bbb'>
XXX
</button>
我尝试使用以下代码,但它们失败了:
Page Should Contain Element | //button/span/following-sibling::text()="XXX"
---> Valid xpath but encountering error in Robot Framework with e
我正在使用python中的Webbrowser库在WhatsApp上发送消息。但问题是,我必须通过转到whatsapp并单击send来手动单击send message。 这是我的代码: import webbrowser
num = ('72********')
message = ("Message sent using python!!!")
a = webbrowser.open(f'https://web.whatsapp.com/send?phone=+46{name}&text={message}', new = 2
? org.openqa.selenium.InvalidSelectorException: invalid selector: Unable to locate an element with the xpath expression //a[Contains(Text(),'Forgot Password?')] because of the following error:
SyntaxError: Failed to execute 'evaluate' on 'Document': The string '//a[
这就是我所拥有的
for arrow in self.driver.find_elements_by_xpath("//img[contains(@src, 'disclosure_closed.gif')]/"):
arrow.click()
但它把这个扔给了我
selenium.common.exceptions.InvalidSelectorException: Message: invalid selector: Unable to locate an element with the xpath expression //img
我使用的是Selenium库和python。在页面上,我收到了多个报价,每个都有相同的链接开头的....和相同的类,但问题是我找不到有多个类的元素。它还具有相同的属性"data-cy“
我试过了
offerName = driver.find_element_by_xpath("//a[contains(@class, 'marginright5') and contains(@class, 'link') and contains(@class, 'linkWithHash') and contains('details