Oracle apex open file browser automatically on page load - javascript

I need to open "File Browse" item ("P50_BLOB") on page load.
I tried clicking the item with dynamic action on page load with javascript:
$('#P50_BLOB').click();
it didn't work, though it does work using the console.
I have also tried using async / wait / promise / wait for document to load.
I even tried to do it with another apex item that will make that click when it is changed, and manually changing the item is working, but on page load it's not.
This is supposed to be very simple but nothing works.
Thanks.

If you try that with the developer tools open in Chrome you will see an error:
Googling that led to this SO question:
File chooser dialog can only be shown with a user activation error while using web scraping through Javascript

Related

Javascript Profiling with Chrome Devtools

I am trying to profile some javascript code on this url by setting an event listener breakpoint on mouse click.
When you click on any flight on the results page, it opens a new tab with another link and the logic to build that link must be using javascript, since there is no network traffic going on when the click is done.
The problem is when doing a profiling it shows some js functions called but none of them related to the new tab opened. Maybe it is related to some other event? Any other ways to profile this use case?
Basically the goal would be to understand how that new tab link is generated and get it without the need to actually click it, using data that must be already present somewhere on the code beforehand.
Any insights would be appreciated!

Keep JavaScript injection despite of refreshing the page

I want to inject some JavaScript code that loads a new page and then executes a function. But when it loads the page, it doesn't execute the rest of the code. I have seen on the internet, that when a new page is loaded or refreshed the JavaScript console is cleared. I have tried with a Chrome extension that injects the JavaScript code, and it doesn't work neither.
What can I do? Here is the JavaScript code:
var button = document.getElementById('skip_bu2tton'); // ID of the button
setTimeout(function(){
button.click();
alert("OK");
},12000);
window.open("**URL**","_self"); // URL opened in the same tab
There is some way to make the Chrome Extension Injector to make this automaticaly, so it must open the URL, wait a few seconds, click that button and repeat that process over and over again.
I think chrome local overrides might be just what you are looking for.
Here's the info how to use it: https://developers.google.com/web/updates/2018/01/devtools#overrides

Javascript redirecting on everypage can't remove

I have a javascript file that was accidentally added to the admin side of our site. The javascript is below,
<script>
if (document.getElementById("errorTitle") != null && document.getElementById("errorTitle").innerHTML === "Insufficient Privileges") {
window.location.replace("/portal/InsufficientPrivileges");
} else {
window.location.replace("/portal/FileNotFound");
}
</script>
The problem is that this code runs on the admin pages so we are unable to remove it. If we disable javascript on the browser the page never renders, dynamic content. How can we disable this from running so we can upload the proper file?
You might be able to edit the page that contains the reference to the problem file. If you can just edit the page to jump over where that code is called with an if statement or goto.
If you can't edit the other pages then you can Use the debugger to change the code executed on the fly. Chrome and Firefox have debuggers that should be able to do this.
Specifically for Chrome you go into the object inspector (available via menus or right clicking on the page). Then you can see the HTML on the left window. You select the script tag of interest, you can right click and select delete or select "Edit HTML"
If the page redirects you before you're even able to edit anything, you can use automated tools.
Fiddler (Windows)
Fiddler lets you see all pages downloaded, and then you can have it send your browser a different page when it tries downloading any page you specify (AutoResponder feature). This way you can temporarily edit a page while you can fix it in the admin panel.
Greasemonkey (Firefox) or Tampermonkey (Chrome)
These plugins let you run JavaScript code on a page as soon as it gets to your browser. This will let you do things such as removing the script tag programmatically.

Will Firefox start my SDK extension automatically after the browser starts - loading screen

I am new on add-on development using the SDK.
I want to ask you guys if it is possible to start my extension automatically after I open my browser? At the moment I starts after I press my widget icon in the toolbar (the panel shows a table with some data I get from the DOM).
Another thing I want to ask you: is it possible to show a loading screen (like a ajax gif) inside my panel (my extension needs a few seconds after switching a tab, to get the DOM data) every time I press the toolbar button.
First of all: One question per post, please.
Extensions are always started with the browser. When it comes to SDK add-ons, your main.js will be called. It's your job to perform any additional initialization form there.
Panels contain regular HTML pages and therefore can use images.
It's impossible to tell you more, without you providing more details and the code you got so far!

How to make Chrome DevTools reload only selected resource?

Is there a way to force reloading only specific resource-files from DevTools?
I'm developing site with ExtJS MVC, that results to almost 100 JS files. Mostly I'm debugging the controller by filling an form -> sending form -> detecting an bug in controller -> fixing it -> reloading whole site -> filling the form again -> another bug -> reload...
It would be very helpful to reload only the controller-part of the code, so that the JS-files contructing the forms would not be affected, thus increasing load times and dropping need to fill the form on every iteration.
So, is it possible? Or could the browser even work this way?
u can use Local Modifications in Source panel (right click in panel) to change or debug Your code, or You can open specific js file in new windwow and than reload it, but I don`t think You can apply reloaded file to site without reloading it itself.

Categories