使用硒在Facebook Messenger中自动测试机器人。如何找到机器人用户和响应的文本框?

问题描述 投票:0回答:1

我们正在尝试使用硒自动测试facebook messenger bot

[我们正在尝试使用xpath定位Messenger的文本框,但没有这样做。

这里是文本框的HTML

<div class="_5rpu" aria-autocomplete="list" aria-expanded="false" aria-haspopup="false" aria-label="Type a message..." aria-owns="js_6" role="combobox" spellcheck="true" style="outline: medium none; white-space: pre-wrap; overflow-wrap: break-word;" tabindex="0" aria-describedby="placeholder-jlsi" contenteditable="true">

我们是硒新手。请帮助!

selenium selenium-webdriver facebook-messenger facebook-messenger-bot
1个回答
0
投票

[我发现在Messenger.com上找到文本框的最简单方法(在Python中是switch_to_active_element,因为Messenger似乎默认将文本框设为活动元素。

例如,

textbox = driver.switch_to_active_element
© www.soinside.com 2019 - 2024. All rights reserved.