I have a requirement to add headers to every request on UI action. so be it opening home page, click on buttons or links I need to add few headers. I need to do this in protractor so that I can automate the functionality. Can you please give me some example on how I can do this?
I am using Jasmine2 + protractor 5.1.2.....
Currently we use fiddler to add the headers to perform manual testing. We want to automate the test cases and send headers from automation instead of fiddler.
Related
I'm building a web app (well at least one page on it) that shows the results of pings to different IPs.
I have no probs on Go displaying them on an HTML page. The simple thing I can't do (and I read so many tuto/threads that I'm lost and don't know what to do....) is to create a button "Refresh" that could just call back the "pingip" function i created in Go file.
Anyone has a concrete/"easy" example on how I could do this?
Assuming you have a HTTP Handler for your Go program, which is what is serving the page - then you can have the button simply do a window.reload() through JavaScript, which will reload the page in the browser and re-invoke the Go script.
If you want this to happen without a reload, then you'd have to create a different HTTP Route and use AJAX (look up the fetch method in JavaScript), get the results over the network (maybe as JSON) and then update the data in the frontend.
I am using Lighthouse from command line to audit my website.
In order to access my website from Chrome, I need to send custom headers (Using Modify Headers Extension).
However, when I am launching lighthouse from command line:
lighthouse http://x.y.z.a:888
It opens a new Chrome window (which has no Modify Headers Extension) and thus requests are sent without headers, without which the website is not accessible and hence not auditable.
Any suggestions as to how to send custom headers with lighthouse using command line?
This is not currently possible. Upvote GoogleChrome/lighthouse#2746 to request the feature.
Aside: The CLI has a flag called chrome-flags which lets you pass in Chrome flags to LH. I was curious if there's a workaround there, but there's not. The full list of Chrome flags is described in List of Chromium Command Line Switches.
I am currently learning how to use JMeter so I can test my company's website. I set up a thread group and put in a few HTTP requests that should log into the site and navigate the tabs. The problem is that it does not appear to be logging in. When I look at the response data, I see that the log in request returns the correct temporary redirect page, but every request after that simply returns the html for the initial log in page.
I have tried using a simple HTTP request that sets the username and password text boxes to account details I know work. I have also tried using a Login Config Element and an HTTP Authorization Manager, and they all get the same thing. I tried changing the redirect options as is suggested here, but it was already set to "Follow Redirects". I tried switching it back too, and that didn't work.
I don't know what to do here. Can anyone help me out?
EDIT: I am going to be away on break for the next week, so I won't be able to respond to answers. I'll be back on Dec 3rd.
In the absolute majority of cases it's connected with cookies.
Try adding HTTP Cookie Manager and see what happens.
If you want to manipulate cookies you may wish to store them to JMeter Variables. To enabled this functionality you'll need to set next property:
CookieManager.save.cookies=true
The property lives in jmeter.properties file under /bin folder of your JMeter installation.
it depends how page is reacting if the session is getting stored in cookie you need to have cookie manager. otherwise search for session_id, or token you need to extract token using regular expression extractor and pass it with login form user name and password.
i hope below video can help you little
http://www.youtube.com/watch?v=1V0E8CEabUY
I'm looking for a way to POST data to a backend script, use it to generate a temporary file on the fly (temporary in that it's dynamically generated and not saved to disk on the server), and then offer it to the client as a download.
I have the backend script functioning fine. The problem is that I haven't yet found a way to get the download prompt via an AJAX call.
If I weren't POSTing data, I would just use something like:
window.location.href = 'path/to/my/script.php';
Is what I'm after even possible? Can it be done without resorting to "hacks" like dynamically injecting a form into the DOM and submitting it, or opening up another browser window, etc.?
make POST request;
create the resource;
answer with the resource path;
window.location.href = resourcePath.
[optional] want to secure such resource from third part download? Attach a CSRF token, and make the resource available only if CSRF check is passed - otherwise congratulations, you just won a 403 puppy!
If the resource has proper headers, the browser will ask you to save / open it with specific app. / an so.
You can't do that without a classic form submit unless you can somehow make the download available via GET.
However, doing that would be a good idea anyway since download managers etc. often don't work well with POST - so simply make your script generate a temporary URL and then redirect to that URL using the JavaScript you already posted in your question.
I'm just trying to get data from a json feed from an external server into my webapp.
I don't know enough about javascript to custom build my webapp so I was relying on the dashcode UI (specifically the datasources, dragging fields, etc.)
Is there a way to get around the cross domain policy and continue to use the datasource part of dashcode? I tried doing a JSONP request, but whenever I put the .js file into the datasources it says it is not a valid feed.
Please tell me if it is possible to get around the crossdomain policy while also continuing to use the dashcode datasource UI to assign values such as title and content easily into the webapp.
This explanation might be a little confusing, I'm just concerned that it won't be possible to continue using the datasource UI because the code is not actually being run until the app is launched. Just looking for some clarity.
Click on “Widget Attributes” in the left-hand source pane. Under “Network / Disk Access”, make sure that “Allow Network Access” is checked.