Tag: automation

根据时间自动化Jekyll / Github Pages构建

我正在开展一个项目,我只列出当前日期(今天)的post。 让Github(或其他工具)每天午夜00:00重建网站会很棒。 谁能告诉我如何通过Github或任何其他工具完成这项工作? 特拉维斯CI也许? 任何教程或示例都会非常感激,因为我对此非常陌生。

使用watir-webdriver选择本地文件

我正在尝试使用watir-webdriver自动化从html页面中选择本地文件的过程 我有以下HTML test file to upload: 我试图点击id为test的输入,并使用watir-webdriver设置我希望上传的本地文件的路径。 我可以使用以下单击按钮以显示选择窗口 @browser.goto ‘http://www.test.com’ @browser.button(:id => ‘test’).click 然而,我正在尝试使用以下(从研究,这似乎是正确的方法。虽然不工作) @browser.file_field(:name => ‘file’).set(“C:\\path\\to\\test\\file\\validTest.xml”) 这会导致以下错误 Watir::Exception::UnknownObjectException: unable to locate element, using {:name=>”file”, :tag_name=>”input”, :type=>”file”} 试 @browser.button(:id => ‘test’).set(“C:\\path\\to\\test\\file\\validTest.xml”) 导致以下错误 NoMethodError: undefined method `set’ for # 有人可以帮忙吗? 我很难理解为什么file_field选项不起作用。

Ruby Watir – 尝试遍历cnn.com中的链接并单击其中的每个链接

我创建了这个方法来遍历网站中某个div中的链接。 我的方法的一个方法是收集链接将它们插入一个数组然后单击它们中的每一个。 require ‘watir-webdriver’ require ‘watir-webdriver/wait’ site = Watir::Browser.new :chrome url = “http://www.cnn.com/” site.goto url box = Array.new container = site.div(class: “column zn__column–idx-1”) wanted_links = container.links box << wanted_links wanted_links.each do |link| link.click site.goto url site.div(id: "nav__plain-header").wait_until_present end site.close 到目前为止,似乎我只能点击第一个链接,然后我收到一条错误消息,说明: unable to locate element, using {:element=>#} (Watir::Exception::UnknownObjectException) 我对ruby很新。 我感谢任何帮助。 谢谢。