【发布时间】:2012-11-04 10:56:02
【问题描述】:
我正在尝试使用 selenium 单击谷歌翻译中的一个按钮(来自:按钮),但我在这样做时遇到了麻烦。我的目标是从下拉菜单中选择一种语言。
希望这是我要点击的特定部分的 html 代码
<div id="gt-sl-gms" class="goog-inline-block goog-flat-menu-button je" aria-expanded="false" role="listbox" style="-webkit-user-select: none;" tabindex="0" aria-haspopup="false" aria-activedescendant=""><div class="goog-inline-block goog-flat-menu-button-caption">From: English</div><div class="goog-inline-block goog-flat-menu-button-dropdown"></div></div>
看起来 id 是 gt-sl-gms 所以我认为我的 selenium 代码应该是这样的
Open the Browser to google translate
Open Browser ${google_translate} ${browser}
Click From Language button
Click Button gt-sl-gms don't wait
但是,这看起来不像是传统的 html 按钮,所以我不确定这种方法是否是我想要的。
第一个测试通过了,所以我知道 selenium 正在工作,但第二个测试失败了。
有人可以帮忙吗?
谢谢
【问题讨论】:
标签: python selenium robotframework