gpt4 book ai didi

python - 使用 send_keys Internet Explorer 时出现先前的评估未完成错误

转载 作者:行者123 更新时间:2023-11-30 22:23:57 27 4
gpt4 key购买 nike

我使用的是 Python 2.7,selenium 是 3.4.3:

search_field= self.driver.find_element(By.ID ,'Searchbox')  
time.sleep(10)
search_field.send_keys('test' + Keys.RETURN)

它在 Chrome 和 Firefox 中工作,但当我使用时在 IE 中不起作用:

search_field.send_keys('test' + Keys.RETURN)

它将返回错误:

previous evaluation has not completed.

如何使 send_keys 工作?

添加 Html

<div>
<input type="text" value="" id="Searchbox" name="name" class="input-xlarge search-query searchInput" style="padding:3px;" data-reactid=".0.1.0.0.0.1.0.0.1.0.0.1">
<span class="btn btn-small btn-warning" style="border-radius:0px;padding-left:3px;padding-right:3px;height:28px;margin-left:1px;" data-reactid=".0.1.0.0.0.1.0.0.1.0.0.2"><i class="icon-search icon-on-right bigger-110" data-reactid=".0.1.0.0.0.1.0.0.1.0.0.2.0"></i></span>
</div>

最佳答案

错误说明了一切:

previous evaluation has not completed

一个简单的解决方案是将复合语句分解为多个语句,如下所示:

search_field.send_keys("test")
search_field.send_keys(Keys.RETURN)
<小时/>

更新:

根据HTML您已将问题更新为 send_keys <input>内标记您可以使用以下代码行之一:

self.driver.find_element(By.XPATH ,"//input[@id='Searchbox']").send_keys("test")
#or
self.driver.find_element(By.XPATH ,"//input[@name='name']").send_keys("test")
#or
self.driver.find_element(By.XPATH ,"//input[@class='input-xlarge search-query searchInput' and @id='Searchbox']").send_keys("test")

关于python - 使用 send_keys Internet Explorer 时出现先前的评估未完成错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47919975/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com