Simple Opera plugin - opera

How to write a simple Opera plugin?
I'd like to develop a plugin that would change the Referer header of a request based on request's url data.
Opera's website says plugins should be developed using Netscape4 Plug-in API. However there's not so much information about it available. I looked up in my c:/program files/opera/program/plugins and it seems like Opera's plugins are .dlls. What programming language should be used for Opera Plugin Development and do you know of any walk-through about it?

If you only want to modify HTTP requests, it may be easiest to write a proxy server that does that (e.g. hack Squid and configure Opera to use it).
Opera's plugins are only for handling specific media types, e.g. Flash or Quick Time videos and are invoked only via <object>, <embed> or opening of specific file. They're not general-purpose plugins.
Opera has another extension mechanism - UserJS - which is JavaScript ran on every page (similar to Greasemonkey in Firefox). You could use it to modify document.referrer in JavaScript, but not in HTTP headers.

Related

JMeter Screenshotting

I am able to get a screenshot in my JMeter test scripts using the Selenium chrome web driver. This works, but now I want to get screenshots following an authentication request. Is there a way to capture the screen as displayed in the HTTP request?
I don't think there is, theoretically you could try libraries like this one or this one from JSR223 Test Elements using Groovy language, but I don't think you will get what you want
The main reason is given at JMeter project main page:
JMeter is not a browser, it works at protocol level. As far as web-services and remote services are concerned, JMeter looks like a browser (or rather, multiple browsers); however JMeter does not perform all the actions supported by browsers. In particular, JMeter does not execute the Javascript found in HTML pages. Nor does it render the HTML pages as a browser does (it's possible to view the response as HTML etc., but the timings are not included in any samples, and only one sample in one thread is ever displayed at a time).
HTTP Request sampler downloads only HTML, you won't get any images, scripts, styles, fonts, etc. so even if you try to use the aforementioned libraries you will get a "screenshot" which doesn't have anything in common with how does the page look in reality.

What types of dependencies available to do Api automation using selenium?

I am using rest-assured dependency in my project for testing API's with selenium.
Can anyone guide me why basically we use rest-assured dependency in API testing ? (Tried finding the answer from my seniors who developed our project framework and online, i couldnt get any answer why are we using this, it would help me if anyone guides me with the reason ?)
And what are the other ways to do API automation using selenium ?
why should we use them ? (in comparison with rest-assured ?)
Thank you.
Selenium is not typically used for REST API testing. Selenium is a tool that can control web browser. Despite a web browser is a sort of HTTP client, it is very specific client that is intended for browsing web and maintain high level of user security. The above puts certain degree of restriction of what you can and cannot do with the browser. For example:
You can only fire GET request from the address bar
You can do POST request using HTML form but you have to have an HTML page with the form and fixed set of parameters
You can overcome the above if have the page with any javascript client so that you can configure different requests configurations
Points 2 and 3 basically mean you have another level of communication in your framework and that level has to be properly maintained. That's because Web Browser is not naturally intended for interacting with API. But only with very narrow part of what HTTP can offer (again we can overcome that restriction by javascript code executed within the browser but that would be another level of complexity).
RestAssured is pure HTTP client with some handy and neat functionality allowing to easily manipulate with requests and responses. So it allows to fire any type of requests supported by HTTP protocol, parse responses responses and verify them (often all in a single statement).
The latter is naturally designed for interacting with REST API, does not introduce extra levels to your tests, does not have limitation like the browsers have.
Recap
The below schema demonstrates the difference of having your API tests implemented in both approaches:
Selenium case:
Selenium binding lib -> Web Driver -> Browser -> API GET (rarely others - need to maintain special file for that)
Rest-Assured case:
Rest-Assured lib -> API ANY SORT OF REQUESTS
P.S. - In the same way as RestAssured handles API case much effectively than Selenium, Selenium handles Web Testing in much more effective way than RestAssured since the latter cannot neither control browsers nor even execute JAvaScript code. That is why we have two such a powerful and great tools each of which perfectly serves the needs it naturally designed for.
Just because Rest-Assured (RA) is a code-based tool to test API. It supports:
make HTTP(s) request
extract value from response
assert response
Selenium is tool to control web browser, it CANNOT do API testing.
I don't know why you compare Selenium to Rest-Assured. They are 2 different tools that serves 2 different purposes.

Is it at all possible to make HTTP requests with the Adobe Photoshop JS SDK?

I've been looking at the Adobe Photoshop JavaScript Scripting documentation, and have only seen the use of WebSockets for remote communications. I need to implement a plugin that communicates with a backend PHP API written in Laravel.
Does the Photoshop JavaScript SDK allow HTTP requests at all?
I use a modified version of the extendables library to allow Indesign to access data from our local webserver. I don't see any reason why it wouldn't work with photoshop. See extendables.org for the library.
ETA: That link doesn't seem to go anywhere at the moment. The library itself is available here: https://github.com/stdbrouw/Extendables

Automatically testing UIWebView content with Selenium

I have an iPhone application that contains a UIWebView for rendering certain UI aspects. The UIWebView content communicates with the Objective-C side through NSURLRequests. I'd like to test the UIWebView contents with Selenium so it could be automated.
The problem is the communication with the native side, as this is not supported by Selenium. Therefore, a way is needed to "fake" the Objective-C side. The UIWebView sends requests to a specific (non-existant) URL that are then interpreted by the native code and processed. When running the UIWebView's contents with Selenium, these requests will always fail.
Is there a way to somehow provide support in Selenium that would allow catching these requests and providing a dummy response, or is there a better tool for this?
Preferably, I'd also like to run the Selenium tests with Sauce Labs, or a similar Selenium service, so hacking /etc/hosts is not an option either.
Have you tried Appium? It should allow you to write WebDriver tests that invoke the UIAutomation library.

How to use Selenium with Digest Authentication?

I am looking for a good way to use Selenium with Digest Authentication (for a flex UI though I don't think that makes a difference if I can't do authentication). I'd like to avoid platform-dependencies such as using AutoIT to drive browser pop-ups (since cross-platform testing is a motivator for going to Selenium), though if there's a good cross-platform library for doing such things that would work fine.
I'm thinking maybe there is a way to use a separate http client to create a session and then pass the session credentials off to the browser, but I'm not sure how to inject the session ID into the browser requests. That's just an idea I had, not sure how feasible it is.
You could try using an HTTP proxy, such as AuthProxy by #CarlYoungblood.
It's an HTTP proxy server written in Ruby which was developed specifically for testing a server that required basic authentication with Selenium, but it should also work on a server with digest authentication.
Simply explained, you cannot automate a Flex UI from Selenium, as it doesn't handle Flash for testing (you can embed the flash plugin in your browser, but Selenium won't be able to test against flash component...)
Even if you can authenticate, you won't be able to test anything, so, you should try something else, like Sikuli