【发布时间】:2017-06-17 18:45:17
【问题描述】:
我正在构建一个能够允许用户将 Google 快讯创建为 RSS 提要的应用。
刚开始使用 Horseman/PhantomJS,我现在在网页上遇到的问题是单击菜单以在“交付至”上显示选项:
通过浏览器访问此页面并单击您的电子邮件将出现的位置,将出现一个带有两个选项的小div,供您选择“RSS Feed”。通过 Horseman,我找不到点击它的方法。我在click() 之后截屏了看,但什么也没有。我的代码:
horseman
.open('https://google.com/alerts')
.type('input[type="text"]', this.name)
.click('span[class="show_options"]')
.screenshot('/home/gabriel/Desktop/ga-named.png')
.wait(2000)
.click('.delivery_select > div.jfk-select')
.screenshot('/home/gabriel/Desktop/ga-deliver-to.png')
.close()
只有.click('.delivery_select > div.jfk-select') 不起作用。在该特定区域的 HTML 下方:
<div class="delivery_select">
<div class="goog-inline-block goog-flat-menu-button jfk-select" role="listbox" aria-expanded="false" tabindex="0" aria-haspopup="true" style="user-select: none;" aria-activedescendant=":8m">
<div class="goog-inline-block goog-flat-menu-button-caption" id=":8m" role="option" aria-setsize="2" aria-posinset="1">myemail@foo.com</div>
<div class="goog-inline-block goog-flat-menu-button-dropdown" aria-hidden="true">
</div>
</div>
</div>
【问题讨论】:
标签: javascript html node.js phantomjs node-horseman