akephalos icon indicating copy to clipboard operation
akephalos copied to clipboard

multiple submits to/from same page only submit the first time

Open patrickhno opened this issue 13 years ago • 5 comments

Ive narrowed a problem I'm having down to this.

I have these cucumber steps: And I press "Save" And I press "Save"

I tcpdump the connection to the web server.

And I see one POST.

It do not matter if i put a second visit in between or nothing. The second press never leads to a commit.

Can someone elaborate what is going on?

The second step pass in cucumber btw. My tests fail on later expectations as the submits never happened.

patrickhno avatar Jul 08 '11 12:07 patrickhno

I have now also verified that this works perfectly with the selenium web driver.

patrickhno avatar Jul 08 '11 15:07 patrickhno

I even tried to press the button with javascript, and it still fails. page.driver.execute_script("document.getElementById('save_button').click();")

patrickhno avatar Jul 11 '11 08:07 patrickhno

Hi Patrick,

I think that instructions sent to the HTMLUnit driver are atomic. Meaning the second click on the save button is not sent until the first has finished. It makes sense on a headlesss driver.

What happen if you do this?:

page.driver.execute_script("
  document.getElementById('save_button').click();
  document.getElementById('save_button').click();")

Nerian avatar Jul 11 '11 09:07 Nerian

Hi Nerian,

I am not actually trying to click a button twice. That is the result of narrowing the bug description down to a isolated case. My need is to submit a form multiple times, like when you change search parameters and click ok. It really bugs me that akephalos doesnt seem to support such behaviour.

I do not even receive a POST to apache on the second click with akephalos, no matter if its javascript, direct API calls or whatever.

I have full blown tests now that works perfectly with other drivers, but not at all with akephalos, as it refuses to POST to or from pages it has posted to/from before, or something like that.

I have not figured out exactly what in the code that does this. It seems to be deeper down into the htmlunit interface or something.

patrickhno avatar Jul 22 '11 12:07 patrickhno

Hi Patrick,

Do you still have this problem in https://github.com/Nerian/akephalos2 ?

I tried to reproduce this bug, but it works fine for me.

it "Should be able to make four requests to the same page" do session.visit '/form' session.click_button 'Submit' session.click_button 'Submit' session.click_button 'Submit' session.body.should include('visit_number:4') end

Is this what you were trying to do? Can you provide a failing example?

Issue a bug report at https://github.com/Nerian/akephalos2

Thanks

Nerian avatar Oct 16 '11 11:10 Nerian