Cucumber 页面对象 PageObject.default_element_wait = 10 给出错误
Cucumber Page object PageObject.default_element_wait = 10 giving error
我试图通过将 PageObject.default_element_wait = 10 添加到 env.rb 页面来将默认元素超时更改为 10 秒,但我在保存后收到错误消息。
env.rb 页面
require 'rspec'
require 'page-object/page_factory'
PageObject.default_element_wait = 10
PageObject.default_page_wait = 10
World(PageObject::PageFactory)
错误
Dimitris-MacBook-Pro:Cucumber_Automation dimitri$ cucumber features/element_validation.feature
undefined method `default_element_wait=' for PageObject:Module (NoMethodError)
/Users/dimitri/git/Cucumber_Automation/features/support/env.rb:4:in `<top (required)>'
/Users/dimitri/.rvm/gems/ruby-2.1.5/gems/cucumber-1.3.17/lib/cucumber/rb_support/rb_language.rb:95:in `load'
/Users/dimitri/.rvm/gems/ruby-2.1.5/gems/cucumber-1.3.17/lib/cucumber/rb_support/rb_language.rb:95:in `load_code_file'
/Users/dimitri/.rvm/gems/ruby-2.1.5/gems/cucumber-1.3.17/lib/cucumber/runtime/support_code.rb:180:in `load_file'
/Users/dimitri/.rvm/gems/ruby-2.1.5/gems/cucumber-1.3.17/lib/cucumber/runtime/support_code.rb:83:in `block in load_files!'
/Users/dimitri/.rvm/gems/ruby-2.1.5/gems/cucumber-1.3.17/lib/cucumber/runtime/support_code.rb:82:in `each'
/Users/dimitri/.rvm/gems/ruby-2.1.5/gems/cucumber-1.3.17/lib/cucumber/runtime/support_code.rb:82:in `load_files!'
/Users/dimitri/.rvm/gems/ruby-2.1.5/gems/cucumber-1.3.17/lib/cucumber/runtime.rb:184:in `load_step_definitions'
/Users/dimitri/.rvm/gems/ruby-2.1.5/gems/cucumber-1.3.17/lib/cucumber/runtime.rb:42:in `run!'
/Users/dimitri/.rvm/gems/ruby-2.1.5/gems/cucumber-1.3.17/lib/cucumber/cli/main.rb:47:in `execute!'
/Users/dimitri/.rvm/gems/ruby-2.1.5/gems/cucumber-1.3.17/bin/cucumber:13:in `<top (required)>'
/Users/dimitri/.rvm/gems/ruby-2.1.5/bin/cucumber:23:in `load'
/Users/dimitri/.rvm/gems/ruby-2.1.5/bin/cucumber:23:in `<main>'
/Users/dimitri/.rvm/gems/ruby-2.1.5/bin/ruby_executable_hooks:15:in `eval'
/Users/dimitri/.rvm/gems/ruby-2.1.5/bin/ruby_executable_hooks:15:in `<main>'
有什么我做错的地方导致这个错误吗?
谢谢
我找到了答案。原来你需要 'page-object' 以及 'page-object/page_factory'
require 'rspec'
require 'page-object/page_factory'
require 'page-object'
PageObject.default_element_wait=(10)
World(PageObject::PageFactory)
我试图通过将 PageObject.default_element_wait = 10 添加到 env.rb 页面来将默认元素超时更改为 10 秒,但我在保存后收到错误消息。
env.rb 页面
require 'rspec'
require 'page-object/page_factory'
PageObject.default_element_wait = 10
PageObject.default_page_wait = 10
World(PageObject::PageFactory)
错误
Dimitris-MacBook-Pro:Cucumber_Automation dimitri$ cucumber features/element_validation.feature
undefined method `default_element_wait=' for PageObject:Module (NoMethodError)
/Users/dimitri/git/Cucumber_Automation/features/support/env.rb:4:in `<top (required)>'
/Users/dimitri/.rvm/gems/ruby-2.1.5/gems/cucumber-1.3.17/lib/cucumber/rb_support/rb_language.rb:95:in `load'
/Users/dimitri/.rvm/gems/ruby-2.1.5/gems/cucumber-1.3.17/lib/cucumber/rb_support/rb_language.rb:95:in `load_code_file'
/Users/dimitri/.rvm/gems/ruby-2.1.5/gems/cucumber-1.3.17/lib/cucumber/runtime/support_code.rb:180:in `load_file'
/Users/dimitri/.rvm/gems/ruby-2.1.5/gems/cucumber-1.3.17/lib/cucumber/runtime/support_code.rb:83:in `block in load_files!'
/Users/dimitri/.rvm/gems/ruby-2.1.5/gems/cucumber-1.3.17/lib/cucumber/runtime/support_code.rb:82:in `each'
/Users/dimitri/.rvm/gems/ruby-2.1.5/gems/cucumber-1.3.17/lib/cucumber/runtime/support_code.rb:82:in `load_files!'
/Users/dimitri/.rvm/gems/ruby-2.1.5/gems/cucumber-1.3.17/lib/cucumber/runtime.rb:184:in `load_step_definitions'
/Users/dimitri/.rvm/gems/ruby-2.1.5/gems/cucumber-1.3.17/lib/cucumber/runtime.rb:42:in `run!'
/Users/dimitri/.rvm/gems/ruby-2.1.5/gems/cucumber-1.3.17/lib/cucumber/cli/main.rb:47:in `execute!'
/Users/dimitri/.rvm/gems/ruby-2.1.5/gems/cucumber-1.3.17/bin/cucumber:13:in `<top (required)>'
/Users/dimitri/.rvm/gems/ruby-2.1.5/bin/cucumber:23:in `load'
/Users/dimitri/.rvm/gems/ruby-2.1.5/bin/cucumber:23:in `<main>'
/Users/dimitri/.rvm/gems/ruby-2.1.5/bin/ruby_executable_hooks:15:in `eval'
/Users/dimitri/.rvm/gems/ruby-2.1.5/bin/ruby_executable_hooks:15:in `<main>'
有什么我做错的地方导致这个错误吗?
谢谢
我找到了答案。原来你需要 'page-object' 以及 'page-object/page_factory'
require 'rspec'
require 'page-object/page_factory'
require 'page-object'
PageObject.default_element_wait=(10)
World(PageObject::PageFactory)