[英]How to Extract and use the JSESSIONID cookie from firefox browser using selenium webdriver to use same session.
I am working on the UI Automation using a selenium web driver, I want to test the web services which are filling data in the UI. 我正在使用Selenium Web驱动程序进行UI自动化,我想测试在UI中填充数据的Web服务。 When I traverse through the UI, I want to test the data which are filled with the UI element of this web service.
在遍历UI时,我想测试用此Web服务的UI元素填充的数据。 But selenium doesn't support calling web services, so I am using http client, but as this is two different applications I want to use the same session for selenium web driver and HTTP client.
但是selenium不支持调用Web服务,因此我使用的是http客户端,但是由于这是两个不同的应用程序,因此我想对selenium Web驱动程序和HTTP客户端使用相同的会话。 I am using the firebox as my browser.
我正在使用Firebox作为浏览器。
//Assume Wed Driver is initiated properly
Cookie cookie= driver.manage().getCookieNamed("JSESSIONID");
System.out.println(cookie.getValue());
您可以从firebug中提取JSESSIONID cookie值,然后在httpClient中设置setNameer(“ Cookie”,“ JSESSIONID =” + getSessionId())之类的“ Cookie”标头,以在每个请求中发送它。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.