【问题标题】:Unable to send using send_keys python selenium无法使用 send_keys python selenium 发送
【发布时间】:2020-09-02 22:42:51
【问题描述】:

大家好,

我正在尝试使用搜索框中的 send_keys 发送一些文本数据 附在图像中,但无法发送。给我错误。 目前重点是“简短描述”,需要移动 到搜索框并需要发送尝试使用发送文本信息 xpath 但没有帮助。 “Id”不断变化,所以它也不会 帮我。

search box is the textbox where im trying to send the text data

下面是我复制元素后得到的elemnet

<input id="5e3dc64a2f3010109e9a3c96f699b632_text" placeholder="Search" class="form-control" style="width: 150px;" name="5e3dc64a2f3010109e9a3c96f699b632_text" aria-describedby="5e3dc64a2f3010109e9a3c96f699b632_describedby">

下面是xpath:

//*[@id="5e3dc64a2f3010109e9a3c96f699b632_text"]

下面是我用来发送的部分代码

search_box = driver.find_element(By.XPATH, "//span[@class='form-control']")
search_box.click()
search_box.send_keys("Unable to access the shared folder")

【问题讨论】:

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


    【解决方案1】:

    一个问题可能是存在共享相同类名的其他元素。 调试步骤: 你可以试试:

    search_box.click()
    driver.implicitly_wait(10)
    

    在等待期间,观察搜索框是否突出显示。如果没有,selenium 可能无法找到 webElement,并且存在共享相同类名的多个 Web 元素可能是问题所在。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2022-11-06
      • 2021-06-12
      • 2020-05-16
      • 2019-11-18
      • 2022-01-14
      • 1970-01-01
      • 2020-07-30
      • 2020-01-16
      相关资源
      最近更新 更多