Firefox console response raw by default - firefox-developer-tools

Does anybody know how to set the Raw toggle on Firefox console response to Raw by default?
I don't know when this button was added, but now I need to press it every run to actually see the response, otherwise, it gives blank response, very annoying.

As of Firefox 109, there is no way to set the raw display of the response by default.
There is a long-standing feature request for persisting the option, though, which covers this use case.

Related

How to capture alert box using Robot Framework

I try to capture alert screenshot but in the screen doesn't show alert box.
For Example:
AlertTest
Open Browser http://www.seleniummaster.com/robotframeworktest/alerttest.html ff
Sleep 5s
Click Button name=alert_button
sleep 10s
capture page screenshot
Alert Should Be Present This is an alert box
Close Browser
If anyone has experience could you help me please.
To my understanding it is not possible to capture the alert with SeleniumLibrary, because the alert in not a part of the page.
We walk around this by using the BuiltIn Screenshot library and the KW Take Screenshot.
You could try and consider if it meet your requirements.
The behavior you're seeing is due to the Alert should be present keyword automatically accepts the alert. It happens so fast that if often looks that it never happened. By adding the optional parameter action=LEAVE you can check without modifying the behavior. The Keyword documentation shows other options.
*** Settings ***
Library SeleniumLibrary
*** Test Cases ***
AlertTest
Open Browser http://www.seleniummaster.com/robotframeworktest/alerttest.html chrome
Sleep 2s
Click Button name=alert_button
Alert Should Be Present action=LEAVE text=This is an alert box
Handle Alert action=ACCEPT
Close Browser
Although this will solve your: I don't see the Alert part of the problem, you will run into the next one. Taking a screenshot using SeleniumLibrary will not work because of the now present Alert. As suggested earlier, this can be taken care of by the Screenshot Library keyword Take Screenshot .
Please read the Using with Python section carefully as this library depends on Operating System specific Python modules.

before closing the Application browser should prompt conformation

I have a small requirement..
if the user dint sign off or log off then he try's to close the browser IE clicking on 'X' (top right of IE or Firefox browser ) then i need to ask a conformation message like "Are you sure you want to close ?" ...
I am using Master page in my application and i tried the event : "window.onbeforeunload " in my master page its works fine, shows an alert(conformation) message. but if i press back button on the browser(IE on IE or Firefox) then also its firing(but it should not) is there any way to full fill my requirement ..I hope i had explained u clearly...if not pl z let me know........
what i mean to say is.. if the Session("USerid") is active or if it contains any value ie.
Session("USerid")="XXX"
at that moment if user trys to close the browse(click in 'X'/Close button browser either IE or Firefox ) it should give prompt a message "are u sure do u want to close?"..
Its all about design steps - but the close and the back button is the same, the close the page, so maybe its impossible to have them all together.
To open, close your script you can make a simple trick. Place them inside a literal and open or close it.
<asp:literal run="server" id="txtCloseAlert">
<script>
... you code here ....
</script>
</asp:literal>
and on code behind.
txtCloseAlert.visible = !string.IsNullOrEmpty(Session("USerid"));
I've looked into this recently and there does not appear to be a standard / consistent way to do this cross-browser hence you back-button problem.
On IE at least you get an event object passed as a parameter to the onbeforeunload method that you can use to get the mouse position, but in FireFox you don't and you would need some other way to determine whether a confirmation is required. It is quite posible that you could get the mouse position in some other way as I haven't looked into that. Point is that if your mouse is not on your form you probably want a confirmation.
You can look at this SO question:
Prevent browser from closing in asp.net
Or do an Internet search on 'onbeforeunload prevent browser closing'.
In your case a synchronous ajax call can be made to the server to do the test.
HTH

Disabled parameter on an input box: How is possible that I can change its value from Firebug?

This is a code, generated from my .NET 3.5 application :
<input type="text"
rel="0,00 €"
id="ctl00_ContentPlaceBody_ImpostaCompravenditaImmobili1_txtRenditaCatastale"
value="0,00 €"
name="ctl00$ContentPlaceBody$ImpostaCompravenditaImmobili1$txtRenditaCatastale">
Now, when I load it, and through Firebug (but this doesn't matter really, with whatever debugger you use you can do this) I add/delete (for example) disabled="", and I refresh the page (by hitting F5), on the server side it stores this value. And in the page I get after the refresh, the value has been stored in the (I believe) context View of the page.
Is it a bug? Normal behavior? I found it really bizarre!
This behavior doesn't depend on FireBug or a similar plugin. It depends on a browser.
I was able to reproduce this with my Firefox 10.0.1 (I also was able to reproduce this with earlier versions of FF): I added extra chars to my textbox, then pressed F5 and the text in that text box wasn't changed. But after doing a Ctrl - F5 the value in my textbox resetted to the default value.
A simple test shows that FF set the Cache-Control: max-age=0 header when F5 is pressed.
Doing a Ctrl - F5 sent these headers: Pragma: no-cache and Cache-Control: no-cache.
I also was able to find a workaround for this on the server side by using:
Response.Cache.SetNoStore();
This will add Cache-Control: no-store to the response headers (it means do not store any part of either this request or any response to it.).
For a breakdown of other browsers behaviour, check out this answer.
Is it a bug? Normal behavior?
When I faced this first time it was really unexpected to me too.

how do i use firebug or chrome console instead of alert() to see variable values?

how do i use firebug or chrome console instead of alert() to see variable values?
currently, I want to see the value of var i as it increases. Not sure that it's increasing.
You probably want to use console.log(). It just prints the parameters in the firebug console.
More info can be found on http://getfirebug.com/logging.
You can use a breakpoint on this variable. You can find explanations for the Chrome Inspector here: http://code.google.com/chrome/devtools/docs/scripts-breakpoints.html
You could use something like the YUI Logger control - http://developer.yahoo.com/yui/logger/ - which puts a log window on your webpage that you can write debugging messages to and clear/hide/etc.
Or you could try a javascript shell bookmarklet that opens a separate shell in the context of the main window. One example is available at https://www.squarefree.com/bookmarklets/webdevel.html, and there may be others.

getting up to date contents of an iFrame

Is it possible to get up to date contents from an iframe? Lemme explain the problem I am encountering:
function modify_iframe(url){
my_iframe.src = url;
iframe_content = my_iframe.contentDocument;
//....code to modify the content goes here,,,,
}
The first time I call modify_iframe(url_a) it sets the source as I would expect but the iframe_content is a blank document.
The second time I run modify_iframe(url_b) it sets the source as I would expect but the iframe_content is actually that of url_a.
So it seems that contentDocument is not returning the contents of the new source, but rather the source before it was changed. Anyone know why that is and if there is a way around it?
Additional background info: We have been adding an event listener to fire off on the iframe load event which occurs when the src is changed. This was giving us the contents when calling contentDocument; however, users were being prompted that our site had unauthenticated content even though we use https for everything including the src. After removing the event listener we no longer receive the unauthenticated content warning, but the contentDocument of our iframe is always one step behind as described above.
Um, first try using a setTimeout to wait for the page content to load. But that's not a nice solution. What browser are you testing on? If it were me I would try to get to the bottom of the "unauthenticated content" error prompt.

Resources