Why different popup handling for Selenium and Webkit? #2

Closed
jmuheim opened this Issue Jun 24, 2012 · 11 comments

Comments

Projects
None yet
2 participants

jmuheim commented Jun 24, 2012

I really find prickle useful, but I sometimes like to switch between Selenium and Webkit (I normally use Webkit, but when there's something going wrong, Selenium is handier to debug), so it's unhandy that they need different popup handling. Is there any way to unify them?

Thank you.

Owner

despo commented Jul 10, 2012

@sientia-jmu is this still causing you problems?

jmuheim commented Jul 11, 2012

It's not really causing problems, it would just be nice to have the same methods regardless which driver is used. :)

Owner

despo commented Jul 11, 2012

@sientia-jmu I thought I'd make sure before I jumped into it. Obviously, there is a reason it's done this way, as webkit requires to know before the event that triggers the popup happens about it. The easiest way would probably be 'faking' the same behaviour for selenium. Then, it would all be the same. I may be able to get this out by the weekend.

jmuheim commented Jul 11, 2012

This would be really nice. Another thing that's bugging me: Chrome runs in background when driven by my Cucumber tests, which is fine because it doesn't interrupt me when I'm working. Sadly, as soon as a popup happens, Chrome comes to foreground. I guess this is Chrome-specific and you can't do anything about it?

Owner

despo commented Jul 11, 2012

@sientia-jmu this sounds like webkit behavior, over which Prickle has no control, so I don't think so I'm afraid.

jmuheim commented Jul 12, 2012

I was afraid of that.

Anyway, I'm looking forward to your fix for similar popup box handling. :)

Owner

despo commented Jul 12, 2012

@sientia-jmu Webki syntax now works for Selenium too. I have not released the gem yet, as I would like to see If I can figure out a better way of achieving this. In the meantime, you can always get this fix by retrieving the gem off the branch by adding the following in your Gemfile:

gem 'prickle', :git => "git://github.com/ExtractMethod/prickle.git", :branch => "webkit_syntax_for_selenium_popups"

Let me know how it goes!

  • Despo

jmuheim commented Jul 13, 2012

Thanks a lot for your efforts! I will check it out soon.

jmuheim commented Jul 13, 2012

It doesn't seem to work for me:

alert = popup.accept {}
alert.contains_message? 'Are you sure?'

results in

Text  is not contained in the popup. (Prickle::Exceptions::MessageNotContainedInPopup)

Am I doing something wrong?

Anyways, I like the selenium syntax better, seems much more intuitive to me:

popup.message.should eq('Are you sure?')
popup.confirm
Owner

despo commented Jul 13, 2012

@sientia-jmu
well, it should be

alert = popup.accept {
//code that triggers the popup
}

alert.contains_message? "Something"

That's the only way I can make it consistent because if you look in the code below, I need to setup a listener before triggering the popup.

https://github.com/ExtractMethod/prickle/blob/master/lib/prickle/capybara/popup/webkit.rb#L41

Agreed, Selenium syntax around popups is way better, but needs to be sacrificed if you want to test with both Selenium and Webkit.

jmuheim commented Jul 15, 2012

That's a real pity then. I guess I will simply use chrome and forget about webkit, because I would have to rewrite some fundamental scenario codes otherwise. Thanks anyway! :)

@jmuheim jmuheim closed this Jul 15, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment