斯普林特的作品在互动,但不是作为临时工

2024-06-06 16:37:31 发布

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

我正在使用pythonspinter自动下载信息。你知道吗

作为浏览器交互的一部分,我希望用字符串填充网页上的文本框。你知道吗

如果我以交互方式运行python3.4,从程序中一次剪切并粘贴每个spliter命令,我可以在firefox浏览器上看到作为响应执行的每一行,这一切都正常工作;但是当我执行程序时,查找文本框的命令失败,并显示以下错误消息:

selenium.common.exceptions.ElementNotVisibleException: Message: Element is not currently visible and so may not be interacted with
Stacktrace:

The Splinter commands are
   browser.find_by_id('addMore_institution').click()
   browser.find_by_id('addMoreText_institution').fill(institution+"\n")

在Firefox中为文本框使用inspect元素是:

<input style="background-image: url(&quot;/static/images/common/icon_search_grey.png&quot;); cursor: default;" autocomplete="off" id="addMoreText_institution" class="addMoreTextbox ui-autocomplete-input" placeholder="Find an existing institution or group" data-entitytype="institution" type="text">

我试过使用find_by_xpath和其他spliterfinby命令,但没有效果。 有人能建议我怎样才能让这个项目运作吗?你知道吗


Tags: 命令browseridinputbynot浏览器common
1条回答
网友
1楼 · 发布于 2024-06-06 16:37:31

在find \u by \u id命令之前添加一个sleep(12),立即解决了这个问题。然后,程序继续并轰炸另一行,这是通过添加一个睡眠(12)前立即解决。你知道吗

在关于selenium的帖子中有一个wait-until可见代码。 斯普林特有没有类似的药?你知道吗

相关问题 更多 >