小编Eze*_*tha的帖子

如何获取page_object元素的attribute_value?

想象一下,我有一个像这样的图像:

the_image = @browser.image(:id, 'image01')
Run Code Online (Sandbox Code Playgroud)

获得其类的价值的方法可以是:

image_status = the_image.attribute_value('class')
Run Code Online (Sandbox Code Playgroud)

好.我正在使用page_object gem并假设我将图像作为元素,如:

image(:the_image, :id => 'image01')
Run Code Online (Sandbox Code Playgroud)

要获取attribute_value,我可以使用:

image_status = the_image_element.attribute_value('class')
Run Code Online (Sandbox Code Playgroud)

......但是我得到了一份弃权警告:

*** DEPRECATION WARNING
*** You are calling a method named attribute_value at page.rb:68:in `get_status'.
*** This method does not exist in page-object so it is being passed to the driver.
*** This feature will be removed in the near future.
Run Code Online (Sandbox Code Playgroud)

如何class使用page_object元素获取值?当然答案很简单,但我没有找到它.你能告诉我路吗?

先感谢您!

ruby cucumber watir-webdriver pageobjects page-object-gem

5
推荐指数
1
解决办法
3808
查看次数

使用Gems或Jenkins(或两者)在多台机器上并行化黄瓜BDD测试

我正在使用带有Cucumber的 BDD (带有page_object gem),WatirJenkins运行一个项目.现在,我们正在寻找并行化测试的最佳方法,以减少多个虚拟机上的测试时间,使用不同的导航器等.

我认为有两种方法:

  • 使用像parallel_test,Hydra,TestJour,TestBot这样的Ruby工具......
  • 或者通过Jenkins组织一切,使用路径,标签等.
  • 以某种方式使用两者

为了在正确的方式上付出努力...你认为Jenkins是在多台机器上进行并行测试的好选择还是我应该给另一个工具机会?欢迎提出建议:)

selenium-grid watir cucumber parallel-testing jenkins

4
推荐指数
1
解决办法
3615
查看次数

远程webdriver上的Chrome(通过网格)无法启动

我在使用Grid上的远程webdriver功能(使用Firefox和Chrome的1个linux集线器和1个linux节点)启动Chrome的Cucumber测试时遇到了麻烦.Firefox测试非常顺利,但Chrome返回以下错误:

unknown error: Chrome failed to start: exited abnormally
(Driver info: chromedriver=2.2,platform=Linux 3.2.0-23-generic-pae x86) (WARNING: The server did not provide any stacktrace information)
java.util.concurrent.ExecutionException: org.openqa.selenium.WebDriverException:    java.lang.reflect.InvocationTargetException

Command duration or timeout: 20.67 seconds
Build info: version: '2.30.0', revision: 'dc1ef9c', time: '2013-02-19 00:15:27'
System info: os.name: 'Linux', os.arch: 'i386', os.version: '3.2.0-23-generic-pae',      java.version: '1.7.0_25'
Driver info: org.openqa.selenium.chrome.ChromeDriver (org.openqa.selenium.WebDriverException) (Selenium::WebDriver::Error::UnknownError)
Run Code Online (Sandbox Code Playgroud)

浏览器初始化为:

$profile = Selenium::WebDriver::Chrome::Profile.new
$profile['download.prompt_for_download'] = false
$profile['download.default_directory'] = downloads_path

capabilities = Selenium::WebDriver::Remote::Capabilities.chrome(
    platform: "Linux",
    version: "",
    "chrome.profile" => $profile)

browser = Watir::Browser.new(
    :remote, …
Run Code Online (Sandbox Code Playgroud)

selenium google-chrome webdriver selenium-grid watir

4
推荐指数
1
解决办法
1万
查看次数

在Cucumber上为多个功能使用相同的浏览器实例时出错

我在为Cucumber驱动程序创建浏览器实例时遇到问题.如果我在"之前做"的env.rb中创建对象:

Before do
@browser = Watir::Browser.new 'firefox'
end
Run Code Online (Sandbox Code Playgroud)

...工作正常,为每个功能打开一个新的浏览器,并在"After do"上关闭它.

这会降低执行速度,因为新浏览器会启动并关闭每个功能.但是如果我在"之前做"中创建@browser以便为所有功能使用相同的浏览器会话,则会出现以下错误:

**Unable to pick a platform for the provided browser (RuntimeError)**
Run Code Online (Sandbox Code Playgroud)

......根本没有进行任何测试.我正在使用页面对象gem,ruby-on-rails ......

你能告诉我,我做错了什么?非常感谢!

ruby-on-rails cucumber watir-webdriver pageobjects page-object-gem

3
推荐指数
1
解决办法
2022
查看次数

如何获取page_object元素的html源代码?

想象一下,我有一个div(用Watir语言):

@browser.div(:id, 'home_slideshow')
Run Code Online (Sandbox Code Playgroud)

我需要里面的html代码来做一些"魔法正则表达式":).获取div html代码的方法可能是:

the_div_html = @browser.div(:id, 'home_slideshow').html
Run Code Online (Sandbox Code Playgroud)

好.我正在使用page_object gem并假设我将div作为元素,例如:

div(:slide_show, :id => 'home_slideshow')
Run Code Online (Sandbox Code Playgroud)

要获得html里面我可以使用:

the_div_html = slide_show_element.html
Run Code Online (Sandbox Code Playgroud)

......但是我得到了弃权警告:

*** DEPRECATION WARNING
*** You are calling a method named attribute_value at home_page.rb:80:in `get_slide_code'.
*** This method does not exist in page-object so it is being passed to the driver.
*** This feature will be removed in the near future.
Run Code Online (Sandbox Code Playgroud)

如何使用page_object元素获取html代码?正如我之前提出的一些类似的问题,确定答案是如此简单,但我看看Cheezy书,整个stackoverflow和页面对象rubydoc信息,我没有找到它.你能告诉我路吗?

先感谢您!

ruby cucumber watir-webdriver pageobjects page-object-gem

3
推荐指数
1
解决办法
776
查看次数