I'm using selenium for my automated browser testing but it is failing while testing the login process. the reason being the way I'm sending my csrf token in the requestHeader instead of sending it with the form which I found a sandard way to deal with ajax based forms. here
我正在使用selenium进行自动浏览器测试,但在测试登录过程时失败了。原因是我在requestHeader中发送我的csrf令牌而不是使用我找到一种处理基于ajax的表单的方式发送它的形式。这里
I found one way around this problem by using proxy to inject additional headers to the requests generated by the browser. But I'm looking for better options if available.
通过使用代理为浏览器生成的请求注入其他标头,我找到了解决此问题的方法。但我正在寻找更好的选择。
1 个解决方案
#1
1
I presume you're using Selenium WebDriver instead of old Senelnium RC.
我认为你使用的是Selenium WebDriver而不是旧的Senelnium RC。
Selenium WebDriver is just automated user using the browser.
Selenium WebDriver只是使用浏览器的自动用户。
You should need nothing custom to make it work. Just be sure jQuery finished setting up everything and the browser should send the custom header along with request.
您应该不需要任何自定义来使其工作。只需确保jQuery完成了所有设置,浏览器应该发送自定义标头以及请求。
#1
1
I presume you're using Selenium WebDriver instead of old Senelnium RC.
我认为你使用的是Selenium WebDriver而不是旧的Senelnium RC。
Selenium WebDriver is just automated user using the browser.
Selenium WebDriver只是使用浏览器的自动用户。
You should need nothing custom to make it work. Just be sure jQuery finished setting up everything and the browser should send the custom header along with request.
您应该不需要任何自定义来使其工作。只需确保jQuery完成了所有设置,浏览器应该发送自定义标头以及请求。