I am getting a print screen option on clicking a button. I made no changes to the js or HTML file of my webpage to change the onclick() behavior for the botton, I wrote some kind of a print command in the chrome debugger console and since then the pop-up is coming. I don't exactly remember the command. How do I undo this change? On pushing the code to GitHub, this behavior was repeated in the production environment.
Related
I am trying to build a homepage of a website in Kali Linux. So, I installed VS Code and added an extension " Live Server " written by Ritwick Dey. I made HTML file, then CSS and now JavaScript. When I was writing HTML and CSS files, everything was normal with Live Server. But when i started writing JavaScript file, there happened a glitch. Every time, when I take rest after writing some text in alert(" ");, the browser automatically opens.
I had used only alert("some text");in JavaScript file. After, I made some changes in file by adding some other statements such as document.getElementById("appname").innerHTML="howdy"; Other statements do not made any disturbance but when I write alert("some_text");, the browser automatically opens.
I had enabled Auto Save as "afterDelay" and, while writing this question, I gave "off" value to Auto Save, it stopped automatically opening the browser but when I save the file, it opens the browser.
I do not want to let the browser open automatically, when I save the file. I want to open the browser manually.
you can put your alert in a function with javascript, make a timer on onclick button so it works when you want it not when server loads
i wanted to ask if there are web elements blocked by default? If yes is it possible to not block them anymore?
Im running a cypress test and after clicking a save button there has to be a messagebox(similar to an alert).
This messagebox is not showing up after clicking the button.
Did anyone have similiar experiences?
Some infos :
Browser used : Edge
messagebox has the div tag
messagebox is nested inside of an iframe
I tried to run the test with the minium amount of code to verify if not some kind of comparision blocked me. But thats not the case.
I also tried a cy.wait for a longer time to see if it loads up.
I also tried a cy.reload but still nothing.
When i do it manually on Edge everything is working fine. The messagebox is showing up after clicking the save button but when cypress runs the test it just isnt showing up.
When i click on the button manually inside the cypress testrunner it´s also NOT showing up.
When I use Firefox developer tools to edit the body of a webpage, the page buttons either disappear or stop functioning like in the example below. This does not happen in Chrome and all the buttons work fine as they suppose to.
here are the steps that lead to the problem:
I go to the webpage that I need to work with, then I need to edit a few things in the page so I press Ctrl+Shift+C to open the dev tools, right click on <body> then Edit As HTML and change what I need to change and apply it and it works just fine with Chrome but in Firefox and other browsers the buttons stops working or disappear.
Here's the link to the example page. (This is only an example not the real page I'm working with, because the real one is in Arabic and requires more steps.)
This is because the Firefox DevTools obviously do the same as when you copy the outer HTML and then execute this
document.body.outerHTML = `*copied HTML*`;
inside the DevTools' console.
That's why all the event handlers as well as iframe contents are gone after you finish editing the HTML, e.g. in this case you can't edit the code at the left side and there is no output shown at the right anymore.
The Chrome DevTools seem to do something smarter here and recognize what has changed and only update those parts when you save the HTML. Therefore the output on the example page is still visible afterwards and the code can still be edited.
I've filed an enhancement request for that, so the behavior in this case can get improved.
I'm using selenium IDE (currently available only on firefox) to do some automated testing of a site I'm coding. When selenium navigates to, a form filling page, and fills in the info - a 'window.alert()' is called by a button.
When using selenium my set of commands look like this:
open /
clickAndWait document.form1.Action[1]
select stuff
type stuff
etc, etc
click name=myPreview
When I click through recording this the first time, it works no problem. When I rerun the script window.alert and alert don't work from the console or anything. I've debugged it, and its not working.
When a window.alert() is called as part of a selenium script (I'm talking at least in the IDE), it is called even though a user watching does not see an alert pop up. According to the documentation:
Under Selenium, JavaScript alerts will NOT pop up a visible alert
dialog.
Selenium does NOT support JavaScript alerts that are generated in a
page's onload() event handler. In this case a visible dialog WILL be
generated and Selenium will hang until someone manually clicks OK.
Both assertAlert and verifyAlert are both based off getAlert(), all of which do the alert 'stuff' in the background. So try adding these functions to ensure that the alert is working, run the script, and then check to see if it works.
A note: this only works if you ensure the test fails before you put in the alert (basic idea of testing, fail first - make test pass).
I am using bootstrap modal, I dont know where I have put the js code that triggers the modal after clicking the button.
jQuery('#signin').modal('show');
I checked each file...even checked each JS file in source in browser.
How can I find which code is triggering the event in browser when I am clicking the button to open a modal?
Use a developer tool for a browser which will allow you to perform Javascript debugging. Your best bet is most likely Firebug. If you set a debug point at a line within a JS file, firebug will allow you to inspect the stack to see which line has called the function.
Instructions
In Firebug, click the script tab.
Select your .js file using the drop down.
When the JS file displays find the target line and click to the left of it, setting a debug point.
Load your page, the script should stop at your debug point.
Click the Stack tab on the right and inspect.
Searching for Script in Firebug
If you click the script tab you can enter a known piece of the script in the upper right hand corner of firebug, this should take you to its location in the code.
I agree with Kevin, another option is to print the stack trace using something like:
http://www.codeovertones.com/2011/08/how-to-print-stack-trace-anywhere-in.html