Trying to get all cookies in the current page using Chrome driver with java .
Please help me to retrieve all cookies in the page once after close browser and trying to open new browser with old cookies.
Using the WebDriver API available at:
http://selenium.googlecode.com/svn/trunk/docs/api/java/org/openqa/selenium/WebDriver.Options.html
Get all cookies for current page and parse to Collection of cookie Objects:
driver.manage().getCookies();
//TODO Parse results to Cookie Objects and Do what you want
Getting cookies from all domains
In automated tests there might be instances where we have to validate cookies of a website.
Webdriver has simple and powerful API to retrieve cookies of current page domain. Here is the sample code to read cookies:
public Dictionary<string, string> GetAllPageCookies()
{
return _driver.Manage().Cookies.AllCookies.ToDictionary(cookie => cookie.Name, cookie => cookie.Value);
}
Related
I'm new to WordPress & Woocommerce and have been trying to get cart content using cocart's for a website running on a different domain to sync the cart between a Woocommerce website and a React Application
I've added some products in the cart from the shop website and calling the "mydomain.com/wp-json/cocart/v1/get-cart" REST API from Postman but getting an empty array in the response.
From their doc, they mentioned a Cart Key and Cookie: wp_cocart_session_, but I'm confused on how to get the Cart Key.
Any kind of help will be highly appreciated.
Thanks in advance
use this plugin
https://wordpress.org/plugins/cart-rest-api-for-woocommerce/
or you can save the product id in sqlite and fetch data from woocommerce rest api to every product in the sqlite database and count the total
I had the same problem. Cookies apparently need to be sent with the request as well as the cart_key.
I solved this by installing the Postman Interceptor browser extension.
In Postman, click "Cookies" and it should ask if you want to setup Interceptor for the domain that you are requesting from. It will install a browser extension and get the cookies and add them to your Postman requests.
Postman provides an assisted step-by-step setup of Interceptor and cookie capture, but to manually access cookie capture settings click the icon in the upper right of Postman that says "Capture requests and cookies with Postman". That's where those setting are.
More about Interceptor here: https://learning.postman.com/docs/sending-requests/capturing-request-data/interceptor/#installing-interceptor
I am using react js for front end and spring boot for backend. Now, I have a situation where I need to get some kind of browser signature or browser specific information to store on the server so that from every new request, I can verify if user is hitting URL from the same browser or from some other browser.
I have tried serveral ways to get browser specific information at backend but not succeed. Please guide me which browser specific information, I can send get in my spring-boot URL and then store that for further verification process.
Thanks in advance!
I would try to set cookies on the client browser and track the cookie/session value on the server side.
For example you can set the cookie-
// create a cookie
Cookie cookie = new Cookie("someUniqueValueLike", uuid);
//add cookie to response
response.addCookie(cookie);
Read cookie
public String readCookie(#CookieValue(value = "someUniqueValueLike") String uuidString) {
//verify the cookie value here
}
Java Firefox webdriver unable to navigate with previous execution cookies .,, basically unable to access with already stored in profile cookies
Tried with cookie class driver.manage().addcookies, not refreshing even after refreshing in different ways
Tried setting default profile..
Still not worked.
Could anyone please advise what changes to do to access Firefox with existing profile and cookies
i am building a web app using angularjs and am using firebase as my database and storage.
my issue is that i am trying to get a .txt file from my storage and display it in the browser, but whenever i make a request using the download url that i got using the firebase sdk i get a cors error.
i am authenticated in firebaseAuth and i have already been able to download images via the 'src' attribute.
this is my request:
$http({
url: url,
method: 'GET'
}).then(function(data){
console.log(data);
}).catch(function(e){
console.log(e)
});
I don't want to override the cors options if i don't have to. does anyone know how i can do this?
I am using firebase hosting to host the site, which shares the same url as my firebase storage
OK.
Thanks Mike Macdonald for your comment.
I'll just do what it says in the other thread you sent me
I have a problem with communication between angular and laravel.
Its about mobile application that needs to log in to a laravel framework and get some data.
Mobile application is angularjs based, and for login i user standard $httpd function.
Login works fine, and i get expected response from laravel, but when i make another request assuming that im loged in, laravel returns NULL for session and auth. When I upload mobile app to a server where laravel is installed all works like a charm. But my app needs to be on mobile device, so thats not a solution.
I assume that the problem is in cors or cross domain communication. It seems that laravel destroys session made from cross origin requests, because that session is not accessible from another request, and on another request laravel tries to make a new one.
I need help solving that session problem (access session after login or keep session), i hope some of you have some kind of a solution.
i tried :
changing headers in my login controller
changing get to post
adding content type to my angular http req (Content-Type': 'application/x-www-form-urlencoded)
tried requerst with jquery ajax
changed laravels app/config/session.php values of driver, cookie, domain...
setting vendor/laravel/framework/src/illuminate/http/frameGuard.php x-frame options to false
no luck!
Use json web tokens, and simply set it up so that you request a JWT on login, and you can share that token around - the only way it invalidates, is either if you lose the token, or it times out.