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

atambo 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.

Show comment
Hide comment
@jonleighton

jonleighton Apr 19, 2012

Contributor

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.)

Contributor

jonleighton 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.

Show comment
Hide comment
@monfresh

monfresh 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 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.

Show comment
Hide comment
@monfresh

monfresh 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?

monfresh 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.

Show comment
Hide comment
@route

route Sep 3, 2013

Member

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

Member

route 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.

Show comment
Hide comment
@jherdman

jherdman Nov 4, 2013

Any progress on this?

jherdman commented Nov 4, 2013

Any progress on this?

@route

This comment has been minimized.

Show comment
Hide comment
@route

route Nov 4, 2013

Member

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

Member

route 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.

Show comment
Hide comment
@sirvine

sirvine 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

sirvine 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.

Show comment
Hide comment
@mkarklins

mkarklins Dec 4, 2013

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

mkarklins commented Dec 4, 2013

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

@michaelglass

This comment has been minimized.

Show comment
Hide comment
@michaelglass

michaelglass 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

michaelglass 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.

Show comment
Hide comment
@gamov

gamov commented Feb 18, 2014

👍

@vizcay

This comment has been minimized.

Show comment
Hide comment
@vizcay

vizcay Apr 29, 2014

+1 This will be really useful!

vizcay commented Apr 29, 2014

+1 This will be really useful!

@thedelchop

This comment has been minimized.

Show comment
Hide comment
@thedelchop

thedelchop Apr 30, 2014

Contributor

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.

Contributor

thedelchop 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.

Show comment
Hide comment
@rickmzp

rickmzp commented May 2, 2014

+1

@mgmorcos

This comment has been minimized.

Show comment
Hide comment
@mgmorcos

mgmorcos commented May 2, 2014

+1

@tsgautier

This comment has been minimized.

Show comment
Hide comment
@tsgautier

tsgautier commented May 2, 2014

+1

@paulcruz

This comment has been minimized.

Show comment
Hide comment
@paulcruz

paulcruz commented May 2, 2014

+1

@lubert

This comment has been minimized.

Show comment
Hide comment
@lubert

lubert commented May 7, 2014

+1

@yaauie

This comment has been minimized.

Show comment
Hide comment
@yaauie

yaauie May 7, 2014

Member

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.

Member

yaauie 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.

Show comment
Hide comment
@marnen

marnen 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.

marnen 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.

Show comment
Hide comment
@michaelglass

michaelglass Jul 3, 2014

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

michaelglass commented Jul 3, 2014

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

@mjgiarlo

This comment has been minimized.

Show comment
Hide comment
@mjgiarlo

mjgiarlo 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.

🍻

mjgiarlo 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.

Show comment
Hide comment
@serioushaircut

serioushaircut Sep 10, 2014

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

serioushaircut commented Sep 10, 2014

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

@route

This comment has been minimized.

Show comment
Hide comment
@route

route Sep 10, 2014

Member

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

Member

route 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.

Show comment
Hide comment
@badosu

badosu 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.

badosu 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.

Show comment
Hide comment
@Bastes

Bastes 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

Bastes 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.

Show comment
Hide comment
@twalpole

twalpole Jun 2, 2016

Contributor

@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

Contributor

twalpole 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.

Show comment
Hide comment
@Bastes

Bastes 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

Bastes 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