Selenium 3.0.1 geckodriver v.011.1 Firefox 49.0.2不向输入字段发送值

2024-05-16 11:02:38 发布

您现在位置:Python中文网/ 问答频道 /正文

设置:

  • 火狐49.0.2
  • 壁虎v.011.1
  • 硒3.0.1

我对一些使用ractive的输入字段有问题。未设置该值。我可以在Firefox中看到发送到输入字段的值,但是当点击“保存”按钮时,没有设置值。在

我试过了:

driver.execute_script("document.querySelector('#at-OrganizationUnitEditTextInputName_Name').focus()")
driver.execute_script("return document.activeElement") # This returns the the correct element

然后呢

^{pr2}$

这个问题是在升级到Selenium 3.0.1和geckodriver之后出现的。使用旧的firefox驱动程序没有问题。在发送按键之前,我在旧驱动程序中使用了这个设置焦点:

element.send_keys(Keys.NULL) # Set focus
time.sleep(0.2)
element.clear()
time.sleep(0.2)
element.send_keys(keys)

javascript中没有触发“focusin”或“blur”事件。似乎这是模糊事件实际使用时设置值?在

我也尝试了ActionChains和move_to_元素,但由于以下例外情况而无法使用:

在selenium.common.异常.WebDriverException:消息:POST/session/325f067c-755d-4401-9c42-4219def280eb/moveto与已知命令不匹配

更新: 我用Chrome驱动程序进行了测试,能够将键发送到输入字段。所以我想这是壁虎的问题


Tags: thesendexecutetimedriver驱动程序事件script