Javascript dialog boxes (alert box) in Eclipse too big to close - javascript

I am working on a JavaScript file and using the alert() method to print some object information. I am testing my ".js" file on Eclipse.
Every now and then this information is to big to fit in the alert box so I see the alert box but am unable to see the OK button (located usually in the end of the alert box). So I end up force quitting Eclipse. The same thing also happens with some browsers (Google Chrome). Is there any way to prevent force quitting or is this somehow preventable?
I know this question is somewhat general but it happened to me a lot recently and I am wondering if this can be avoided.

Related

How to display “allow dialogs from … to take you to their tab” in an alert?

I was in a website where an error message appeared in an alert dozens of times, saying only:
error :(
I’m used to websites automatically displaying a checkbox labeled “prevent this page from creating additional dialogs” after many error messages. This should have happened to the above site, but it didn’t. Instead it displayed a checkbox “allow dialogs from [example.com] to take you to their tab?”
Do you know why this happened? How do I reproduce this behavior in my own website?
PS: My browser is Firefox 72.0.2.
EDIT
4 months... Nobody have ever seen such a message?
This shows up in Firefox when a page that is not in view (some browser tab that is not activated) tries to display an alert() dialog. You might get this when some code that runs in background creates an alert message: like when you press a button, and some code runs in the background and you switch to another tab, and now the old tab finishes running and displays alert dialog.

Javascript debugging in qt webkit

Greeting
I'm trying to debug java-script with qt web-kit but its not working.
This is what i do. I right click on qt web-view and choose "Inspect", In inspector window, I go to "Scripts" tab, I choose "Only enable for this session / Always enable" then press "Enable Debugging" button. In java-script file, I place break point in function (by clicking on line number). I can see the line in "Breakpoints" group in right side of window as well. I perform a specific action which causes function's launch (in UI), But nothing happens, The break point not hit and function returns. I invoke function manually from the console by typing its name and arguments and still nothing happens. Function return without hitting break point.
I Also enabled JavascriptEnabled.
Im using QT 4.8 and Visual Studio 2008.
Can any want tell me whats wrong here ?!
Thanks in advanced

Trace Javascript event handling in browser

Is there a browser that will allow me to trace the execution of Javascript events? For example, for some random site online, if I click on something in one area of the page, it causes the text in some other area of the page to get updated with some new text. I would like to be able to trace what happens from the click all the way to the value being updated. When I say trace I mean that I would like the browser to tell me the name of the Javascript function that handles the click (and which file it is located in) and which Javascript function updates the value on the page.
The solution must work for any random website on the internet.
In chrome you can trace js codes in website with DEBUG mode.
Open Chrome.
Open a website.
Open Dev Tool with press F12.
On the menu click Sources. Now you can see all js files at there. And there is a debug panel. You can start, renew, break, trace a code line with these tools.
On js code panel you can put breakpoints on the line numbers.
Press F5 and refresh the page. Code will pause and you can trace js values.

Testing Image Upload in IE11 with Protractor

The Code
I have a linear application where halfway through the user must submit images to continue. The submitFile function is below:
selectFile: function(image) {
var path = require('path');
var image_path = path.resolve(__dirname, image);
this.uploadButton.click();
this.uploadButton.sendKeys(image_path);
}
I know from Selenium that you cannot interact with the OS, just anything contained within the browser. So we've been following the stackoverflow go-to answer for Protractor file uploading.
The Result
The function in practice clicks the file upload button, the dialog box pops up, sendKeys manually tells it what image to use, then it moves on with its life while that dialog box is always open. Chrome and Firefox don't care that the dialog remains, so I can continue testing pages past image upload without issue.
But today, we're getting into trying to automate IE testing and it seems that that pop up must be dealt with to continue. It never hits this.uploadButton.sendKeys(blah);. The moment the dialog is opened IE wants it resolved before continuing.
The Attempts
this.uploadButton.sendKeys(protractor.Key.ESCAPE) right after the click, which didn't work since the test cannot not get past the uploadButton.click().
this.uploadButton.click().then(function() {this.uploadButton.sendKeys(image_path)}), was worth a shot but nope
browser.executeScript('something'); after the click; I forget what the something was but it never got to executeScript
The Thoughts
Is there a way to kill a process from Protractor? To be able to kill explorer.exe / explorer's pid
Is it possible to have a listener to kill the pop up as it happens?
Though would any of the above mess with the sendKeys?
Does the button click and sendKeys even work on IE11?
Right now, I'm just sticking to manual testing for IE, though I'd love to be able to integrate my tests with IE so I can use Browserstack or even just multiCapabilities in my config.

How do I identify if I have a javascript conflict on my website?

I'm currently moving a website from self hosted onto a CMS system. The current site uses a modal popup script called SqueezeBox.js
I've copied the code across exactly how it looks on the current website, however the modal popup box isn't triggering when I click on a thumbnail image.
Looking at the code in the header I've spotted that the CMS I'm using is also calling a number of other javascript files and I'm wondering if one of them is causing a conflict.
What's the best way to find out if this is the case? I've tried Firefox's plugin Web Developer but can't see anything in the Error Console. However I'm not 100% sure I'm using it correctly. Can anyone else point me in the direction of a simple to use javascript conflict detector?
Cheers
Adam
If you have Google Chrome, open up the Developer Tools and you can go into the 'scripts' tab, open up your javascript files and look for the click handler.. click along the side of the code to set a breakpoint, then when the code reaches that spot (if you click it, for example), it will pause, and then in the Developer Tools you can see what functions are being called where as you step through the code. You can also hover over any variable in the code window to see its value. Very handy! You can then see if it's getting into your plugin at all (you can do this as well by setting a breakpoint inside the plugin at a place like the first line that will always be accessed when its run).
I believe you can do the same thing with Firebug
It's a bit of a different thinking process to get into (step into, step over, turning breakpoints on and off etc) but it's extremely useful.
A more simple way of checking where problems are occuring is by adding an alert('im working); or something similar to code you're not sure if it's working. You can also alert a variable to see what the value is at that point. You can also use console command to print it to firebug's console. These are doing things that breakpoints/debugging do for you except with the debugging you don't need to change your code.
If there is a javascript error, then the easies way is using firebug or the Chrome Inspector (right click on the thumbnail and choose "Inspect element"). Open the console tab of either and refresh the page. If there is an error, it will be reported in the console and provide a link to the relevant line.
If there is no error being reported, then the code's logic is preventing the box from being displayed. You'll need to step through the code to find the error. Look at what function is being called from the click handler of the thumbnail image. Go to that function in either tool and place a breakpoint on the first line of the function. Click the thumbnail again and the code will pause on that line. From there you can step through the code and see which code branch is followed. There's likely a sanity check at some point that fails and causes the code to bomb out.

Categories