Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failing on nested classes in DIV #38

Open
antosync opened this issue Sep 16, 2015 · 3 comments
Open

Failing on nested classes in DIV #38

antosync opened this issue Sep 16, 2015 · 3 comments

Comments

@antosync
Copy link

Mario/All.

Have a login page with submit button nested in DIVs. Button is defined like <div class="BS" id="ClientLogin_Ok">Login</div>.

wbench as called by few Ruby lines fails on /Library/Ruby/Gems/2.0.0/gems/capybara-2.4.4/lib/capybara/node/finders.rb:41:in block in find: Unable to find button "ClientLogin_Ok" (Capybara::ElementNotFound).

I had very few time to troubleshoot, so am not sure this is a wbench or capybara bug failing on nested classes in DIV or my fault.

Any idea?

@mariovisic
Copy link
Contributor

Are you calling wbench from the command line or from ruby itself directly?

If you're using it through ruby you'll have to consult the capybara documentation to match the correct elements to perform the login, the ones on the readme are just an example. See here for more info: http://www.rubydoc.info/github/jnicklas/capybara/master/Capybara/Node/Actions

@antosync
Copy link
Author

I am using this Ruby code:

require 'wbench'
WBench::Benchmark.new('https://mysite', :browser => :chrome)
benchmark.before_each do
visit 'https://mysite/login'
fill_in 'username', :with => 'myusername'
fill_in 'password', :with => 'mypassword'
click_button 'ClientLogin_Ok'
end

results = benchmark.run(3) # => WBench::Results.

Ok, I'll look at page you suggest.

PS: Can't run wbench on login pages from command line, right?

@mariovisic
Copy link
Contributor

Yes, so you'll need to change that section to match your form:

benchmark.before_each do
  visit 'https://mysite/login'
  fill_in 'username', :with => 'myusername'
  fill_in 'password', :with => 'mypassword'
  click_button 'ClientLogin_Ok'
end

You could test a page behind a login form, although you'd need to pass a cookie with a sessionID that is already logged in.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants