Does selenium support IE with google frame add on installed on it? - gwt

Selenium is able to load Chrome Frame pages. The problem is that once you load the page in IE with Chrome Frame plugin, the tag appears as empty. Selenium tries to identify elements using the DOM structure, but the way IE and Chrome Frame plugin works, rendering
and DOM tree are taken over by the Chromium code and IE gets an empty DOM.
So i guess, selenium doesn't support IE with google frame add-on installed on it?
Has anyone worked around this problem?
Thanks

This question has been asked and answered on the Selenium user's mailing list. The IE driver doesn't work with the Google Chrome Frame add-on, and there are no plans to implement support for it to work with the Chrome Frame add-on. Either you want to test the operation of your website under Chrome (in which case you should use the ChromeDriver), or you want to test it under IE (in which case you should use the IE driver). If you can point to a specific case where using the website with the Chrome Frame add-on behaves differently than the way it behaves with the Chrome standalone browser, you might be able to make a case to revisit the issue. Furthermore, remember that Selenium is an Open Source project, and you are welcome to make changes and submit patches to the code at any time.

Watir WebDriver has the same issue.
Selenium core, the part that loads in the target browser and executes tests does work and can be run independently. So, if you have a Selenium test suite in HTML form, it can be run in GCF using the following steps:
Configure a web server to opt all URLs into chrome frame using HTTP header as described here: http://www.chromium.org/developers/how-tos/chrome-frame-getting-started#TOC-Making-Your-Pages-Work-With-Google-
Host your test suite under '/tests' folder on this web server. Lets say the suite is my_test_suite.html.
Host the selenium core folder as the '/core' on the server
Now restart the server.
Run the suite with this URL: http:///core/TestRunner.html?test=tests/my_test_suite.html&auto=true

Related

Unable to perform the action on android webview

I am using Robot Framework with python. I have a page that has a web view. I am able to find the element through Appium inspector and also through the Chrome Dev tools. But those locators are not working. The test case passes but it does not click on that element.
Is there any work around for this issue?
Did you try the class name locator?
driver.find_element_by_class_name()

Flutter Web - how to test flutter web application opens in Chrome on desktop?

There is a button on a web page that makes an API call to third party application. And in return third-party application gets rendered on a web page.
Now, the third-party application (https://goknow.me/#/) is developed in flutter and I know nothing about flutter. I'm using java, selenium and webdriver for end to end testing. I'm using same set of tools for the rest of the application and it's working fine.
While inspecting in chrome, the DOM look like this:
Flutter application has a form and I want to find an element so that I can send inputs during testing automation. By searching online I found this appium-flutter-driver. I've also included the required jar in my project. With selenium webdriver I'm not able to find an element in flutter application that renders in Chrome browser on desktop.
Here's the code:
import pro.truongsinh.appium_flutter.FlutterFinder;
import pro.truongsinh.appium_flutter.finder.FlutterElement;
protected FlutterFinder find;
WebElement iframe = driver.findElement(By.xpath("//iframe[#id='know-iframe']"));
driver.switchTo().frame(iframe);
find = new FlutterFinder(driver);
FlutterElement elm = find.text("Email");
elm.click();
elm.sendKeys("hello world");
During testing automation I want to select fields in form and send inputs to those fields.
How to find an element in flutter web application that renders in another web application in Chrome browser on desktop?
Flutter Web is very different from normal web frameworks such as React or Vue. Looking at the official doc, it renders either into HTML elements (but still not the usual elements you see everyday), or directly draw onto a Canvas.
In addition, since it is a third-party app, it is mostly likely that you are not able to change their code. Thus, your appium-flutter-driver mostly will not work, because it says:
Under the hood, Appium Flutter Driver use the Dart VM Service Protocol with extension ext.flutter.driver, similar to Flutter Driver, to control the Flutter app-under-test (AUT).
You know, Dart VM service is only available when you run the Flutter app by source code in debug mode, or at least when you have control to the source code.
Therefore, my suggestion is: Can you treat the Flutter application as a "picture" instead of a DOM tree, and try to locate the buttons?
you can try using io.github.sukgu that helps you to work on the shadow elements. I was able to automate the scenario that you mentioned. Below is the detailed code.
Step 1 add the below dependency
<!-- https://mvnrepository.com/artifact/io.github.sukgu/automation -->
<dependency>
<groupId>io.github.sukgu</groupId>
<artifactId>automation</artifactId>
<version>0.1.3</version>
</dependency>
Step 2 use the below import in the test file
import io.github.sukgu.*;
Step 3 Below is the entire code that worked for me
WebDriver driver = new ChromeDriver();
driver.get("https://goknow.me/#/");
WebDriverWait wait = new WebDriverWait(driver,20);
wait.until(ExpectedConditions.frameToBeAvailableAndSwitchToIt(By.id("know-iframe")));
Shadow shadow = new Shadow(driver);
WebElement emailField = shadow.findElement("input[id='email']");
emailField.sendKeys("hello world");
Flutter team recommends using Flutter for "app-centric experiences" as "Progressive Web Apps, Single Page Apps, Existing Flutter mobile apps", but Flutter web app can also be embedded in a iframe tag.
They say:
At this time, Flutter is not suitable for static websites with text-rich flow-based content. For example, blog articles benefit from the document-centric model that the web is built around, rather than the app-centric services that a UI framework like Flutter can deliver.
You can read more about how a Flutter web app is deployed here.
When a Flutter app is built for the web, the page is rendered in 2 ways:
HTML renderer (on mobile browsers)
CanvasKit renderer (on desktop browsers)
I hope now you know a little more about Flutter framework. 🙂

chrome cache removal for single files

recently I had to remove my entire cache to be able to view a webpage I was working on. This is fine I guess but it could be improved by removing specific pages from the cache.
the chrome.browsingData.remove, seemingly has no option for indicating individual pages for removal. I was wondering if this could be done externally, but I am not familiar with the chromium code. I was also wondering if there are any planned changes to the chrome.browsingData.remove implementation.
Many thanks
To remove a single file cache enter its URL into browser and do hard refresh.
If you are working on a webpage and wish to avoid caching (btw, it's recommended! :) You can do it today in Chrome DevTools.
Go to Settings (the icon in the bottom-right corner) and click on it.
Then, you will have an option 'disable cache' - mark it and you done.
Just don't forget to return this state when you done working as chrome will be faster with its caching schema.
Edit 10/Feb/2022: Access the remote dev tools documentation for a whole suit of tools available to override cached files while developing:
https://developer.chrome.com/docs/devtools/storage/cache/
If you are attempting to clear HTTP cached data, which was the original question in the post, then the network log is where it is possible. the guide for that is here:
https://developer.chrome.com/docs/devtools/network/#load
First find the file then release its cacged content by right clicking:
https://developer.chrome.com/docs/devtools/network/reference/#clear-cache
To remove all files (not single files) while in Chrome DevTools you should click on the Dev Tools settings then choose
"Disable cache (while DevTools is open)". This was the first option on the page - it is now (as of Chrome 103 in 2022) under network in Preferences.
Note that these settings are not the main Chrome settings, but are specific to Dev Tools.
You can reach DevTools by pressing F12 while on a web page you want to debug or by pressing Ctrl-Shift-I.
Edited 28 July 2022
If you're building the page dynamically, then during development, you can put a random string at the end of the URL used to load the script.
<script src="path/to/script.js?_=<%=Math.random()%>"></script>
This will cause a cache miss for that file but will use the cache for everything else (subject to cache-control headers and so on). Just remember to remove the parameter before pushing to prod!
UPDATE : 2019, April 20
Lately, I'm working with Chrome browser's inbuilt feature - Overrides. With this feature, we can write code for HTML, CSS, JS, etc directly in the console and see it on the web-page.
Here's a tutorial that might be helpful
Previous Answer :
I'm working with Google Chrome extension Resource Override.
After installing this extension, I'm overriding the resource which I want from the server instead of cache:
STEP #2 : Override the resource which you want fresh from the server:
⭐Important Note - Access the plugin from the developer-console instead of the browser
⭐⭐ I started with this approach but have moved to approach suggested by Lukas Greblikas in the answer above.
Good Luck...

Standalone GWT Deployment

So, this is a pretty trivial thing to accomplish apparently, but for some reason it just will not work for me. I created a VERY SIMPLE GWT app. It uses UIBinder just to display a label and a button, no actual processing or handling takes place. I did this to test deploying the app using strictly JS and html that is not hosted by Eclipse and Jetty or whatever.
I compile my app, run it in eclipse, and it works fine. However, when I try to run the html page directly from the WAR directory, it does not work.
Do I need this running on a webserver for it to work? It is just html and js, so I shouldn't? I've been to the GWT site about deploying, and surfed quite a few forums. They seem to always mention the necessity of a server, but it seems like it should not be necessary?
Since it is a pure JavaScript and HTML it should work properly without server. Checkout this link: Compile and run in Production Mode with Eclipse
In your EntryPoint class, in onModuleLoad() there's a RootPanel.get("someDivId") call somewhere. Make sure your html page (=the host page) contains a div with that id.
Also make sure your host page calls the right java script file. It's easy to forget to edit the host page after you renamed your GWT module (see rename-to in your .gwt.xml), as the generated JavaScript file matches your module name.
This will work locally on all browsers except Chrome for security reasons.
See http://code.google.com/p/chromium/issues/detail?id=31068
and http://code.google.com/p/chromium/issues/detail?id=70088

GWT Frame not working in Mozilla Firefox or in Google chrome, but working fine in IE

I am trying to download a file from server. The normal GWT RPC call doesnot allow me to do that, and hence I wrote a servlet to do that job for me. From the client side, I am creating a Frame object, and I set the servlet URL in it, and add that frame Object in my root panel.
When I execute this in IE, a window pops up asking for Save/Open file.
But when I execute the same in a Firefox or a Google Chrome browser, nothing is happing.
I am not getting any request on my servlet/server side.
Here is a slice of the code :-
String servletUrl = "http://localhost:13080/Browser/ui/dataExportServlet?level=ZERO";
Frame frame = new Frame(servletUrl);
frame.setVisible(false);
RootPanel.get().add(frame);
So, can someone please help me out.
This might be related to same origin policy.
Are both servlet and webapp running on port 13080?
If they differ, SOP might fail this.
If I understand correctly, IE has a more relaxed policy so it might work there but not in chrome.
See http://en.wikipedia.org/wiki/Same_origin_policy and Can I disable SOP (Same Origin Policy) on any browser for development?
In Chrome, you can use the Developer Tools (CTRL + SHIFT + I) to check if the IFrame is being added to the HTML, and if the frame's source is being set properly. You should also be able to see what content has been loaded into the iframe.
Alternately, set a breakpoint in your servlet to see if the iframe is being hit at all from Chrome.
I got the solution for this issue.
I removed the frames and added the following code :-
com.google.gwt.user.client.Window.open(url, "CSVDownload", "");
Now, this opens a new browser window, and then I get the pop-up to open/save the server side file in all 3 web-browsers. (IE, Mozilla FireFox, Chrome).
Thanks a lot!!!