I am using selenium VBA and on the page there is a search button that I click on using this line
bot.FindElementByXPath("//button[#aria-label='search']").Click
When clicking on this button and inspecting the Network tab and XHR there is a response. How can I get the request url from xhr object?
Related
I am using Selenium with Python and Behave to test a web application. I could not figure out what HTTP method my web application uses to open a new page in a new tab using Selenium. Our application integrates with many internal microservices and we have the UI that makes an API call upon a click event and the the api response for a given call would come back with a URL to redirect to and the HTTP method to use for the redirect.
In my test I want to assert the URL that we redirect to and the HTTP method(GET/POST) our web application used in the new tab to redirect to. I was able to switch to the new tab and assert the URL but not the HTTP method.
Has anyone run into this? Thanks in advance
I am getting the login session through some API. I do the following -
Navigate to the www.example.com
Set cookies through Selenium WebDriver.
Navigate the browser to www.example.com\some-other-path
And voila, the cookies don't get apply as I get the login page again.
However, If I reload the page after doing #2, and then navigate away, the cookies seems to be applied correctly. Any idea guys what could be the issue?
Here is my code -
driver.get("http://www.example.com");
driver.manage().deleteAllCookies();
driver.manage().addCookie(c1); //I have the cookie object
//driver.navigate().refresh(); If I uncomment it, works good
driver.navigate().to("http://www.example.com/some-other-url");
You could go through the following post which talks about using the same cookies
https://sqa.stackexchange.com/questions/15594/selenium-how-to-access-the-same-session-in-a-new-window
Hope this helps
I have a test where I want to check that if a request is blocked, the appropriate error message is displayed on the page. Using chrome, this can be done via Network tab > Right click on request > Block request url. However, I'm trying to automate this url blocking process and would like to know if this is possible in a WebDriverJs setup
I'm using selenium for automating a procedure I frequently use on a site.
When I press on specific element on the site it runs some complex javascript code that eventually downloads a csv file using HTTP GET request.
I can see that the URL of this request looks like: www.somesite.com/somepage.php?token=RAPO09834HROLQ340HGIE309W&....
My question is: how can I get the token in this URL with selenium? (I need it for executing other HTTP GET requests for extracting more data from the site)
I am using Firefox driver on windows.
I tried to search all the html, js, cookies I get from this site, the token is not there. (its probably generated by the javascript code before it does the HTTP request)
I understand this is some kind of session id token as all the javascript generated HTTP requests are using the same token during my session.
Environment:
Firefox with Firebug and Jsonview addons installed and verified to work,
A web service that claims to send the response with "application/json" as the mime type; the service URL does NOT end in ".json".
Problem: Firefox puts up the open/save dialog instead of letting Jsonview to display the content.
Question: How do I see the response headers/content in Firebug for attachments or other responses that otherwise trigger an open/save dialog?
Related question: Is it possible to see headers/content in Firebug for responses that are targeted for popup windows?
Would like to avoid installing other plugins or network monitors if at all possible. Any help is greatly appreciated.
I've noticed that Firebug needs to be "refreshed" when you want it to display a request with Content-Disposition: attachment:
Try to switch to another Firefox tab, where Firebug is not activated, and then switch back to your current tab. Firebug will get refreshed and show also previously invisible request in its Net panel.
EDIT
Now it's known issue 7264