Simulator Freezes With BrowserComponent - codenameone

I have a BrowserComponent that loads a specific URL.
BrowserComponent browser = new BrowserComponent();
browser.setURL(url);
browser.addBrowserNavigationCallback(url -> {
...
return false;
});
This URL redirects to another, with the new page showing a JS alert dialog.
The Simulator freezes without exception or error while attempting to load the page with a dialog, and the only choice left is closing the Sim.
How do I handle a JS dialog in a BrowserComponent?
It will be great if I can dismiss an alert dialog automagically.
My run log:
JCEF Version = 84.4.1.262
CEF Version = 84.4.1
Chromium Version = 84.0.4147.105
initialize on Thread[AWT-EventQueue-0,6,main] with library path ~\.codenameone\cef\lib\win64
Added scheme search://
Added scheme client://
Added scheme cn1stream://
DevTools listening on ws://127.0.0.1:56113/devtools/browser/8a42a5d0-5ad5-4838-9027-ee9737d73370
AppHandler.stateHasChanged: NEW
AppHandler.stateHasChanged: INITIALIZING
AppHandler.stateHasChanged: INITIALIZED
Stream was closed
[EDT] 0:0:18,233 - Codename One revisions: 7dd4e7d08b3442d90959477ee52a5ae8c4361b29
[EDT] 0:0:18,234 -
[0322/062422.651:INFO:CONSOLE(22)] "Here I am !!!", source: https://cn1app/streams/1 (22)

This issue has been fixed in Git with this commit:
https://github.com/codenameone/CodenameOne/commit/c4afc9d428a959e2f8dcf37594bed8ae81e467a2
It will be included in the next Cn1 update this Friday.

Related

Stream was closed after creating BrowserComponent

From 2 years I was using BrowserComponent to display html code and Browser Navigation Callback to catch url changes.
In the past, all things worked fine but currently, there are some issues that I'm facing.
First one:
isuess during redirect to a url from html page:
The webpage at
http://yallagym.herokuapp.com/payment/callback/accepted could not be loaded because:
net::ERR_CLEARTEXT_NOT_PERMITTED
Second issue:
Unable to load html page and white page appears:
[EDT] 0:0:23,863 - Codename One revisions: 7dd4e7d08b3442d90959477ee52a5ae8c4361b29
[EDT] 0:0:23,864 - Attempting to create browser component
[AWT-EventQueue-0] 0:0:23,868 - Attempting to create browser component
Using:
JCEF Version = 83.4.0.260
CEF Version = 83.4.0
Chromium Version = 83.0.4103.106
initialize on Thread[AWT-EventQueue-0,6,main] with library path C:\Users\fuad-\.codenameone\cef\lib\win64
Added scheme search://
Added scheme client://
Added scheme cn1stream://
DevTools listening on ws://127.0.0.1:56645/devtools/browser/0f082d24-9bc9-4a81-b652-7960d4b4e947
AppHandler.stateHasChanged: NEW
AppHandler.stateHasChanged: INITIALIZING
AppHandler.stateHasChanged: INITIALIZED
url:https://cn1app/streams/1
Stream was closed
for first issue I found this build hint could be help
android.xapplication_attr=android:usesCleartextTraffic="true"
For the secound issue I did not find any solution.

Selenium webdriver trying to access popup context

I'm trying to authorize Selenium to install an extension but there's no way to get to the popup context:
My code:
driver = webdriver.Firefox()
#The extension
driver.get("https://addons.mozilla.org/es/firefox/addon/ether-metamask/")
time.sleep(1)
#Perform the act that opens the new window
driver.find_element_by_xpath("//*[contains(text(), 'Agregar a Firefox')]").click()
Popup that shows up:
The popup that shows next cannot be inspected by the browser and I tried to access it by driver.switch_to_alert but that was worthless.

Cannot refresh browser for new version of react app

I try to refresh react app on browser side for new version with this line of javascript :
window.location.reload(true);
It doesn't work on desktop and android Chrome, which seems to keep displaying the cached version it has.

Angularjs pdf viewer full screen view issue in IE

I am using angularjs pdf viewer in my project it is working fine with Google Chrome but while using it with IE when I go full screen by using full screen button in PDF viewer and press escape button it closes the PDF viewer expected behavior is it should close full screen mode and not the viewer, this functionality is working fine with Google Chrome. Not sure how to control this behavior
Any help is highly appreciated.
Just FYI,
I am using IE 11.
The PDF file is being loaded from Server(Azure app service).
Server application is build in C#.net core
Here is my code
included in app.js
app.config(function(pdfjsViewerConfigProvider) {
pdfjsViewerConfigProvider.setWorkerSrc("/pdf.js-viewer/pdf.worker.js");
pdfjsViewerConfigProvider.setCmapDir("/pdf.js-viewer/cmaps");
pdfjsViewerConfigProvider.setImageDir("./pdf.js-viewer/images");
pdfjsViewerConfigProvider.disableWorker();
pdfjsViewerConfigProvider.setVerbosity("infos"); // "errors", "warnings" or "infos"
angular.lowercase = angular.$$lowercase;
});
included package
"angular-pdfjs-viewer": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/angular-pdfjs-viewer/-/angular-pdfjs-viewer-2.0.1.tgz",
"integrity": "sha1-KnYVcp/UC9/01VVyY6aES4Mc=",
"requires": {
"bower": "^1.8.2"
}
}
this is how I have included it in my page
<pdfjs-viewer data="$ctrl.data"></pdfjs-viewer>
controller
$scope.data = null; // this is loaded async
$http.get("http://example.com/file.pdf", {
responseType: 'arraybuffer'
}).then(function (response) {
$scope.data = new Uint8Array(response.data);
});
Try to use F12 developer tools to check if there have some error in the F12 Console tab.
Based on the document, I have tested the angular-pdfjs-viewer demo, after downloading the package and installing the angular-pdfjs-viewer and related dependencies, it will show the following error in my IE11 browser:
AngularJS: disabling automatic bootstrap. <script> protocol indicates an extension, document.location.href does not match.
I tried to add the following code at the end of app.js file:
angular.element(document).ready(function () {
angular.bootstrap(document, ['app']);
});
After adding the above code, the error disappears.
Then, if I open the pdf in full screen mode by using the full screen button in PDF viewer, I could exit the full screen mode by clicking the ESC button. But, if I open the PDF in full screen mode using the F11 shortcut, I can't exist the full screen mode using the ESC key, it only exits by using the F11 shortcut. You could try to check it.
Besides, you could also try to clear the IE browser data (cache, cookie and so on) or resets the IE browser setting. Might be they can help to solve the problem.

Aspx aplication dialog pages(or #dialogiframe) fails to load on chrome/chromePortable with chromedriver 76 through selenium

Aspx aplication dialog pages(or #dialogiframe) fails to load on chrome/chromePortable with chromedriver 76 through selenium. When we open any dialog pages in aspx application it opens blank page and selenium fails with NoSuchElement Found exception. However, we tried this manually on same browser versions and it loads perfectly manually.
It happens only when we launch out browser using chrome driver 75+.
Browser: Chrome/ChromePortable 76
Chrome Driver Version : 75.x and higher
Selenium Version : 3.13
Language : C#
We tried with making w3c false in C# with selenium but it doesn't work because of existing issue : https://github.com/SeleniumHQ/selenium/issues/7521
It seems style = 'height:fit-content' blocking the page to load. when we removed the style or changed the style it worked.
var frame = driver.FindElement(By.CssSelector("dialog[open]:last-of-type #dialogiframe")).UnwrapAllLayers();
driver.SwitchTo().Frame(frame);
var element = driver.FindElement(By.CssSelector("td[style = 'height:fit-content']"));
var jsExecutor = (IJavaScriptExecutor)driver;
jsExecutor.ExecuteScript("arguments[0].style=''", element);

Resources