CSRF verification failed. Request aborted issues on submiting the form using selenium webdrive

430 views
Skip to first unread message

kalyan reddy

unread,
Jan 22, 2014, 9:10:11 AM1/22/14
to seleniu...@googlegroups.com

Issue: On submitting the from the site reports following error

 Forbidden (403)

CSRF verification failed. Request aborted.

More information is available with DEBUG=True.

 The test runs fine for the first time, if I run the same test just after fining the first test the site reports the error.

I am able to fill and submit the from multiple times, with out any issue.

Thanks in advance.



Shawn McCarthy

unread,
Jan 22, 2014, 7:16:51 PM1/22/14
to seleniu...@googlegroups.com
You didn't give much details on your code or the page / form you are trying to submit.
Try responding with as much information as you can.

The exact code you are using, the page (or maybe similar page if the page is private). Maybe any output of the console if it shows errors.

Thanks !

Murali L

unread,
Jan 23, 2014, 2:28:21 AM1/23/14
to seleniu...@googlegroups.com
This tells us that your application has got some kind of protection mechanism for CSRF attacks. I believe the request you are submitting has got some random token (CSRF token) and you have hard corded it. 

Try to replicate the end user way of reaching the page. You will not see this error then!


Thanks,
Murali L

David Lai

unread,
Jan 23, 2014, 11:33:10 AM1/23/14
to seleniu...@googlegroups.com
Usually CSRF errors is because something you submitted didn't contain the CSRF token that was given to you by the server.  Usually this is in the form of a hidden form input or a https cookie, or a combination of both.  You might want to check your flow to make sure you don't skip pages in your flow that are setting these values.

Reply all
Reply to author
Forward
0 new messages