【问题标题】:selenium insert text to microsoft word frameselenium 将文本插入到 Microsoft Word 框架中
【发布时间】:2018-11-03 06:30:03
【问题描述】:

我在 python 中使用 selenium。 我在网站上得到了一些看起来像 word 文档的文本框,我正在尝试将文本插入其中。 但是我没有弄清楚,如何将文本放在那里。

我试过这段代码:

driver.find_element_by_xpath("//[@id='description_heb___Frame']").send_keys("xxxx")

但什么也没发生。 我正在使用 html 代码添加文本框的屏幕截图

【问题讨论】:

标签: python selenium iframe textbox


【解决方案1】:

首先切换到框架:

driver.switch_to.frame(driver.find_element_by_id('description_heb___Frame'))
driver.find_element_by_id('description_heb').send_keys('random text');

当你完成框架时:

driver.switch_to.default_content()

【讨论】:

  • 得到:selenium.common.exceptions.NoSuchElementException:消息:没有这样的元素:无法找到元素:{"method":"id","selector":"description_heb"}
  • 有什么想法吗?我想我找到了更多的内框
  • @user8446864 而不是添加为 cmets,而是使用附加信息编辑主要问题以进行正确分析。
猜你喜欢
  • 2021-06-27
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多