Forum Discussion
11 Replies
- cunderwCommunity Hero
A 400 means that the request was malformed. In other words, the data stream sent by the client to the server didn't follow the rules.
# in a url is called an anchor link, and it's how your browser knows where in the page to position you. It is not a correct endpoint to send a request to. So in a nut shell you're trying to send a request to something that doesn't actually exist.
Use you're browsers dev tools to watch the network requests when you click one of the links. It will striped out the anchor tags.
The only work around would be to removing anything after the #, but more than likely you would just be sending the same request over and over at that point.
What is your end goal here? If you're wanting to test APIs and end points then you should look at something like ReadyAPI.
If you actually want to verify the UI and clicking links takes you to the correct place, then XmlHttpRequest isn't the approach I would use. I would actually click the link and validate the correct page / position loads.
- tristaanogreEsteemed Contributor
Oh, crud... you know, LinoTadros demonstrated a way of using an Attributes checkpoint to do this kind of thing without actually doing any navigation. I'll need to go back and check my notes from Connect 2017 but it was a pretty cool way of validating links on a page. Anyone else remember that? Marsha_R?
- cunderwCommunity Hero
I think the example LinoTadros was using may have just been verifying that all the links are present using NativeWebObject's find method to find everything that was a link. If I'm understanding correctly bb1832j wants to verify the link has a successful response.
- bb1832jOccasional Contributor
I did try to use the WebTesting.WebAccessibility.Check() method. The page I tested had several links intentionally broken. The method still returned all links as passed. With the XmlHttpRequest object, I am able to see the status message and that the broken links were found.
- Marsha_RChampion Level 3
Did you have these checkboxes set properly?
- bb1832jOccasional Contributor
Yes I do...
- tristaanogreEsteemed Contributor
Please show your full code. I'm curious as to why it failed to find the broken links.
- bb1832jOccasional Contributor
For the Web Accessibility object? There is not a lot of code...
function WebAccessibilityCompare()
{
var WebObject;// Obtains the WebAccessibility object
// WebObject = WebTesting.WebAccessibility1;
// WebObject = WebTesting.WebAccessibility2;
// WebObject = WebTesting.WebAccessibility3;
WebObject = WebTesting.WebAccessibility4;
// Checks the web page
// If the verification fails, posts a warning message to the test log
// WebObject.Compare(Page, true, 1000, lmWarning);
//WebTesting.WebAccessibility1.Check();
//WebTesting.WebAccessibility2.Check();
//WebTesting.WebAccessibility3.Check();
WebTesting.WebAccessibility4.Check();}
Related Content
- 8 months agojayrichardson
- 10 years agoNisHera
Recent Discussions
- 2 days agoGane195