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

Support accepting javascript confirmation dialogs #50

Closed
atambo opened this issue Apr 19, 2012 · 27 comments

Comments

Projects
None yet
@atambo
Copy link

commented Apr 19, 2012

Selenium allows you to:

page.driver.browser.switch_to.alert.accept

How can I do something like the above with poltergeist?

@jonleighton

This comment has been minimized.

Copy link
Contributor

commented Apr 19, 2012

Poltergeist ignores alerts/confirms by default. If that's not happening it's a bug, but I think it just works. (This is also what capybara-webkit does.)

@monfresh

This comment has been minimized.

Copy link

commented Sep 3, 2013

Is there a way to know whether an alert did appear to begin with? I'm trying to test that user-provided input is sanitized, so that if they change their name to <script>var x = 1;alert(x)</script>, it doesn't run the script. I want to be able to confirm that an alert appeared when the code does not do the sanitization (i.e a failing test). Is that possible?

@monfresh

This comment has been minimized.

Copy link

commented Sep 3, 2013

I ended up using capybara-webkit for this by using page.driver.alert_messages to determine if any alerts are present. Does Poltergeist have an equivalent?

@route

This comment has been minimized.

Copy link
Member

commented Sep 3, 2013

I'll reopen it as a reminder to check it, come back as soon as possible

@route route reopened this Sep 3, 2013

@jherdman

This comment has been minimized.

Copy link

commented Nov 4, 2013

Any progress on this?

@route

This comment has been minimized.

Copy link
Member

commented Nov 4, 2013

I didn't have time to look into this yet, if anyone has please go ahead

@sirvine

This comment has been minimized.

Copy link

commented Nov 15, 2013

It would also be nice to have the ability to send keyboard input to JS prompt dialogs (and get their text content), as per Selenium's Alert class: https://github.com/vertis/selenium-webdriver/blob/8f4aefa604e76b24085c91f70f97a093e40a08d6/lib/selenium/webdriver/common/alert.rb

@mkarklins

This comment has been minimized.

Copy link

commented Dec 4, 2013

Would be nice if Poltergeist implemented something similar to page.driver.alert_messages

@michaelglass

This comment has been minimized.

Copy link

commented Jan 25, 2014

here's what I've been doing in my tests

kind of janky but it works.

I don't know if I wrote this or stole it.

https://gist.github.com/michaelglass/8610317

@gamov

This comment has been minimized.

Copy link

commented Feb 18, 2014

👍

@vizcay

This comment has been minimized.

Copy link

commented Apr 29, 2014

+1 This will be really useful!

@thedelchop

This comment has been minimized.

Copy link
Contributor

commented Apr 30, 2014

Next week I am on vacation and will try to see if we can implement this since it seems to be getting a lot of interest.

@rickmzp

This comment has been minimized.

Copy link

commented May 2, 2014

+1

4 similar comments
@mgmorcos

This comment has been minimized.

Copy link

commented May 2, 2014

+1

@tsgautier

This comment has been minimized.

Copy link

commented May 2, 2014

+1

@paulcruz

This comment has been minimized.

Copy link

commented May 2, 2014

+1

@lubert

This comment has been minimized.

Copy link

commented May 7, 2014

+1

@yaauie

This comment has been minimized.

Copy link
Member

commented May 7, 2014

If someone submits a pull-request, we will be glad to review it & get the feature merged. Comments with "+1" don't do anything to drive this feature forward since @teampoltergeist/committers doesn't really have the resources to do feature-request-driven development.

@marnen

This comment has been minimized.

Copy link

commented Jul 3, 2014

@michaelglass Thank you. That looks like it will work for me for now, though I wish this were in Poltergeist for real.

@michaelglass

This comment has been minimized.

Copy link

commented Jul 3, 2014

@marnen yer welcome! super janky but such is life.

@mjgiarlo

This comment has been minimized.

Copy link

commented Jul 3, 2014

@michaelglass Paraphrasing Rumsfeld re: janky code:

As you know, you go to production with the code you have, not the code you might want or wish to have at a later time.

🍻

@serioushaircut

This comment has been minimized.

Copy link

commented Sep 10, 2014

I'd (still) love to see that generically in poltergeist

@route

This comment has been minimized.

Copy link
Member

commented Sep 10, 2014

I think @gongo is doing great job for all of us #516

@route route closed this Sep 10, 2014

@badosu

This comment has been minimized.

Copy link

commented May 26, 2015

@michaelglass solution works very well until a proper fix is pushed.

This should be referenced somewhere as it would have saved a lot of time for me.

@Bastes

This comment has been minimized.

Copy link

commented Jun 2, 2016

@michaelglass Waiting for a proper implementation in poltergeist, this is an awesome solution ^^ kudos sir, you've made my and my teammate's day ^^d

@twalpole

This comment has been minimized.

Copy link
Contributor

commented Jun 2, 2016

@Bastes Poltergeist has had support for Capybaras modal api since September 2015 - you shouldn't need to be including anything else. If it's not working for you please open a new issue with details.
http://www.rubydoc.info/github/jnicklas/capybara/Capybara%2FSession%3Aaccept_alert

@Bastes

This comment has been minimized.

Copy link

commented Jul 1, 2016

@twalpole Indeed it works ^^ could benefit from a little publicity too imo, I'll see if I can send a pull request with a little something in the readme. Thanks ^^d

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.