【问题标题】:Selenium Grid 2 Tests with RubySelenium Grid 2 使用 Ruby 进行测试
【发布时间】:2023-04-06 10:22:01
【问题描述】:

我最近发现了 Selenium Grid 2。我之前使用过 Grid、IDE 和 RC,为此编写测试非常简单,尤其是使用原始 Grid。 (可能是因为我没用过web-driver?)

Grid 2 文档在编写实际测试方面仍然很不稳定。

谁能帮我开始 Ruby 测试?也许只是一个简单的例子就可以了。

还有 DeepTest 与 Grid 2 的集成...或类似的东西。

提前致谢。

【问题讨论】:

    标签: ruby selenium-grid automated-tests


    【解决方案1】:

    对于任何可能感兴趣的人,测试将采用这种格式:

    require "rubygems"
    require "selenium-webdriver"
    driver = Selenium::WebDriver.for(:remote, :desired_capabilities => :firefox)
    
    driver.get "http://google.co.uk/"
    driver.find_element(:id, "lst-ib").clear
    driver.find_element(:id, "lst-ib").send_keys "selenium 2 webdriver"
    driver.find_element(:xpath, "//ol[@id='rso']/li/div/span/h3/a/em[3]").click
    driver.find_element(:link, "Selenium").click
    driver.find_element(:id, "q").clear
    driver.find_element(:id, "q").send_keys "grid2"
    driver.find_element(:id, "submit").click
    
    driver.quit
    

    测试是远程运行的,如果你想在本地运行,那就改变:

    来自

    driver = Selenium::WebDriver.for(:remote, :desired_capabilities => :firefox)
    

    driver = Selenium::WebDriver.for(:firefox)
    

    http://code.google.com/p/selenium/wiki/RubyBindings 是一个很好的参考。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-11-25
      • 2011-12-20
      • 2016-04-25
      • 1970-01-01
      相关资源
      最近更新 更多