Disable/hide refresh button in Firefox browser - firefox

I want to disable the RightClick>Reload functionality in Firefox.
I know that it cannot be done through js running on a specific web page.
How to disable it entirely for the browser? (Assuming I can alter the browser behavior)
Is it possible to create a manual patch/addon that makes this change in the Firefox code base?

The browser window contains three <command> elements related to reloading pages: Browser:Reload, Browser:ReloadOrDuplicate, Browser:ReloadSkipCache (I didn't bother figuring out how these are triggered). The first one is the only important one because the other two will disable automatically if it is disabled (they contain the corresponding <observes> element). So your extension would need to run the following code in the browser window:
document.getElementById("Browser:Reload").setAttribute("disabled", "true");
Only problem is that the browser window itself will also disable/enable this command, from the onLocationChange() method of its progress listener (the command should be disabled for about:blank). I guess that the solution is to register your own progress listener do the same thing in the onLocationChange() method (your listener should be called after the browser's because it is registered later).

If you do it via a XUL overlay, you can completely disable it:
<command id="Browser:Reload" oncommand=""/>
<command id="Browser:ReloadOrDuplicate" oncommand=""/>
<command id="Browser:ReloadSkipCache" oncommand=""/>
Then you don't need to add a listener.

You don't have to reinvent the wheel. Use Menu Editor. I've been using it for ages. Should be enough.
Install it, open settings, choose Main context menu from dropdown. Find Reload and uncheck it. Voila.

Related

Selectors only work when webpage is opened in Internet Explorer

I created a login sequence and my selectors for the input email, password, click login and element exists are valid. But only when I have the Internet Explorer page open on the website I'm working with.
I did that sequence again, and I ran it, initially it worked but when I ran the hole project it broke again, I tried "repair" and "indicate", I tried to eliminate the title but nothing is working.
As far as I can see, you are using selector attribute:
"title=ACME System 1 - Dashboard"
Try using a wildcard: title='ACME System 1*', so it can work when you leave the dashboard.
This worked for me when I took those UiPath Academy courses.
In order to automate tasks within a browser with UiPath, the browser must be open. There is an activity called Open Browser that's included in the default activities for every project. You need to add this activity to the beginning of your sequence and pass in the appropriate parameters, (ie. URL, browser type) you can then pass the outputted browser variable to an attach browser sequence and execute your browser automation acivities within that.
Browser activity sceenshot
In addition, the selector that you have shared does not look like a stable selector. There may be other 'H1' elements on the screen that will cause your automation to fail. I would use the UI explorer to help you build a better, more stable selector.
Did you initially use IE to indicate screen elements and then changed the BrowserType property to use a different browser? Please share the sequence to suggest you a fix for your issue.
I would also suggest you to modify the selector to 'title='ACME System *'.
In order for selector to work the application needs to be open and the desired element needs to be available. So when you close the browser the selector disappears.
You may consider swithching to 'Modern Design Experience' and use 'Use Application/Browser' scope to make this more intuitive, and it will also automatically open the browser for you if it is closed.

cypress how to close the new window and back to main test window

I have written codes to click on hyperlink then check the new window URL.
cy.get('a[href*="newlink"]').eq(0).click()
cy.url().should('equal', 'https://www.google.com')
how do i close this window / or not close AND back to the original main test window?
here's a solution i use for swapping between popup windows: https://github.com/jakedowns/CypressHelpers
it would need some tweaking to work directly with .click
but it does enable cy.openWindow and a new cy.switchWindow / cy.closeWindow
under the hood it uses an undocumented
cy.state('document') and cy.state('window') method for context-switching
cy.go(direction, options)
See the documentation for examples
This works for the history in the same tab. Cypress does not support multiple tabs.
you can use cy.go('back')
see here

GitHub Gist creation and editing not working in Firefox?

Long story short:
I tried to create/edit GitHub Gists with
Firefox 67.0 on Windows 10
Firefox 67.0 on Linux Fedora
Add-ons: NoScript, Ghostery, LastPass
Tried with NoScript and Ghostery disabled and also with NoScript in "all shields down" mode and also with Firefox in "safe mode".
Problems:
Creation of a Gist is arbitrary. More often than not, the two buttons "create public gist" and "create secret gist" just stay disabled and the editor widget is "dead".
Occasionally, creation works, the editor widget goes lives and displays line numbers and the editor buttons become active. But it happens annoyingly rarely.
Editing a Gist is arbitrary. Again, it sometimes works but currently I just get blank editor widgets that have no cursor.
Anyone else who has these problems? It may be a temporary hiccup, or maybe there is some JavaScript that Firefox doesn't like. However, a web search brings up nothing - I can't believe I am the only one stuck with this this.
My earlier testing fails completely. I was sure I had tested in safe mode with no change in result.
However I retested with the latest Firefox update (FF 67 on Linux) and found out that it is the LastPass plugin which is the root of the problem. I would not have suspected that.
Disable that plugin, leaving all the others active and Gist creation and Gist editing work.
Enable that plugin and Gist creation and Gist editing work once after a Firefox restart. But after that, you get the unresponsive text entry widget.
Similarly, running Firefox in safe mode with all plugins disabled also fixes the "problem".
And of course, if you do this using Konqueror instead of Firefox, creation/editing work too.

parent & child browsers view got switched during automated execution by HP UFT

I am facing a strange issue with my test automation scripts when executed through HP UFT 12.01
Our AUT is a web based application developed in actimize. During my test flow, lets say at 5th step i need to invoke a popup browser (child) from my main page. The new popup browser will not have any menus or back/fwd buttons.
3 out of 10 executions, during 5th step my main browser gets refreshed to invoke the popup and when popup rendered fully, contents and views got switched now. i.e., main browser has the contents which are supposed to display in popup window (with menu bar and back/fwd buttons) and pop-up window has main page contents (without menu bar, back/fwd buttons) & state when i performed click operation.
This is strange and i could not really conclude if its browser issue or UFT issue. I have also checked with functional team and they never faced, so this is happening only through UFT execution and speculating it could be UFT issue.. any help pls?
This sounds like it could be either:
1) an actual bug in your UAT
2) a problem with QTP object identification.
If it's #2, here's some things to check. First, make sure that QTP can correctly and reliably identify the two different "browsers". (i.e. while both are on the screen, use the "Highlight in Application" button found the Object Repository window while each of the objects is selected. I would try this for both a normal run and immediately after the browsers get switched (use a break point if necessary)
If there is a problem with QTP identifying the windows incorrectly, then you might want to add additional Description properties to the test object in the OR so that it can lock onto the right one more reliably. I usually use GUISpy to spy on something on the page, then in Object hierarchy I click on the top object (the browser), then click "Copy identification properties to the Clipboard" button, then paste the results into a notepad. Find one of those properties that uniquely identifies the browser objects from anything else. Sometimes I have to use the URL property (with some REGEX magic to isolate the specific page without making it TOO specific)

Problem with Pop-up Windows using Selenium

I'm new to the testing world, so my question might seem a lil' bit too naive and stupid. At risk of looking/sounding stupid, my question is this:
I've been trying to test the contents in a pop-up window on my company's web app. I've figured out how to detect the pop-up window for now, but i can't get selenium to 'click' on the link inside of that pop-up window. there are multiple pop-ups in this web app so it's really difficult for a newbie like to create a test case.
I tried the click, clickAndWait, mouseDown and mouseKey as an option but it is still not working. can somebody guide me through this?
TIA,
Angela
When the popup appears you will need to move the context of the script over to the window.
You can do this by using the selectWindow | window_ID_from_the_link and then do the clicking.
If that doesn't work you may need to use the openWindow command to create the popup and then start testing against that.
Use getConfirmation/getassert/getprompt according to the type of the pop up you use .....By default they will be clicked with ok option by the server and you have to consume the message from the pop up for the other selenium commands to work correctly.............
The above suggestion is given from my experience in working with selenium RC used with perl..........
Perhaps you can try the FireFox Plugin. You can click through your application and record your steps. After recording the steps you can easily save it as some sort of file or unittest.
I'm not sure about the command you should use for the popups, maybe the firefox plugin will help in this manner (it will create your commands).
If you created the popup with a div tag, U can use following code to stop the selenium server until the popup opens.
int second = 0;
while(!selenium.IsElementPresent(mylink))
{
if(second >= 5)
break;
Thread.Sleep(1000);
second++;
}
After a popup opens, Now you can click on any link inside the popup.You have to use the below code.
selenium.click("id=popup_link"); (popup_link is the id of the link present on the popup)
Good Luck.
Not sure if this is what you are looking for, but if you want to click on something specific that Selenium is not able to handle - like browser pop-ups or other pop-ups, you can use Sikuli Script. Sikuli does an image comparison and clicks on the same - this is very powerful.
Here is the link: http://www.sikuli.org/

Resources