Call firebug lite methods from javafx 2.2 webengine - javascript

I want to execute Firebug lite in my webengine and then call some methods from the script. First i execute the script as described in here and its work fine. The problem starts when I try to call and execute a method inside from the script. First I have a 'Exit' button in the webview and in the event of the button i call the method shutdown to close the script. Below is the code:
eng.executeScript("window.Firebug.shutdown();");
The firebug immediately disappears from the webview. Then I have another button 'Start' and in the event i want to open again firebug with the code below, but nothing happens. No errors or exceptions appear and seems that the script executes correctly.
eng.executeScript("window.Firebug.startOpened=true;");
I also try the method initialize() eng.executeScript("window.Firebug.initialize();");and then i get an exception like below:
netscape.javascript.JSException: TypeError: 'undefined' is not an object
at com.sun.webpane.platform.WebPage.twkExecuteScript(Native Method)
at com.sun.webpane.platform.WebPage.executeScript(WebPage.java:1438)
at javafx.scene.web.WebEngine.executeScript(WebEngine.java:811)
at student.WebBrowser$2.handle(WebBrowser.java:126)
I also want to know which method in the script executes when the user clicks the ShowInNewWindow button and from an JSObject in javafx catch the event and open firebug in a new form.
Thanks in advance.

Related

Cannot Inspect Element for Webpage

I am trying to in inspect element for a webpage https://supremenewyork.com, every time I try to inspect element the site crashes and I get a debugger paused exception in any browser I try, why is this?
They have the keyword debugger as debugger; somewhere in their code that gets executed through a condition whenever the web page is inspected, which has the same functionality as setting a breakpoint in the debugger, but you can easily click Deactivate breakpoints then click Resume script execution which should bypass that.

Selenium IDE automation seems to break JavaScript window

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).

click not work on IE9 ruby webdriver

I'm using this code to click on an element: #driver.find_element(:id, "test").click and it works well when I run script on FF16 with Selenium Ruby Webdriver (selenium-webdriver-2.26.0.gem).
However, when trying to run script in IE9 browser (using IE driver: IEDriverServer.exe), no error occurs, but Click event does not work, Selenium seems to ignore this line of code and go to next lines of code.
Note that this issue does NOT happen when I tried to click on many other elements on my application (ex: button, link), it only happens with some elements I want to click.
Please help guide me how to resolve for Selenium to fire Click in IE9 browser. Thanks much.
Try click using JavaScriptExecutor or Click after moving to the element. refer below C# code
((IJavaScriptExecutor)driver).ExecuteScript("arguments[0].fireEvent('onclick');", element);
or
Actions action = new Actions(driver);
action.MoveToElement(element).Click().Build().Perform();
where element is IWebElement instance of element to click

How do I use Firebug to tell me what JavaScript is being fired?

I'm trying to reverse-engineer some JavaScript and, annoyingly, the JS isn't terribly clear or well-documented. I've got a series of events that are fired (using JQuery) that I need to find where the function lives.
Is there a way of configuring Firebug (or the Opera/IE consoles - not Chrome/Safari) so that I can see what events are fired when I click a button?
Thanks
In firebug, select console tab. Click on profile, do your activity on page, again click on profile...list of called function will be listed below in firebug panel.
I suggest that you get started with the "Using FireBug Console for Faster JavaScript Development" tutorial.
You could add a console.log() to every click method. Or simply add an Event listener to the document and console.log() some details or the event when something is clicked.
You can use the Firebug Profiler, e.g. by calling profile() in the console before your action and profileEnd() after the action. Firebug will then tell you which methods have been executed in the meantime (incl. lots of information about it).

javascript firing before its event occurs

I'm trying to troubleshoot a rather large file where a javascript is misbehaving—a function is firing before it's event occurs. I know the event hasn't occurred because it's happening onload, and I don't have any onload events (just focus,blur,click,keyup which are binded to form elements). Is there a Firefox plugin/add-on or something that will give me a play-by-play of what javascript is doing what as it's happening? I have Firebug and the Developer Toolbar, but I didn't find that feature in them.
Yes, In firebug just go to the SCRIPT tag and add a breakpoint in the function that is being called unexpectedly. When it stops on that break point click the "Stack" tab to see where it was called from.

Categories

Resources