Credit Card Transaction script fails webdriver, if another window is opened manually - firefox

I am executing credit card transaction script through webdriver. So there is form where the details are to be filled and then click on “Submit” button to perform successful transaction.
Here, transaction script gets executed on firefox browser, and in between if another browser say Safari is opened manually, then transaction script which is getting executed on firefox through webdriver, it gets fail
Environment : WebDriver 2.43,
Firefox Version: 32.0
Please correct me, if i am performing anything wrong

The first thing you should do is, you need to switch to new window from initial window and then perform some operation and switch back to your initial window.
To know how to switch between windows, watch this video.How to switch between multiple browser windows using webdriber

Related

Dismissing the accept cookies dialog

For the web app that I am automating (cloud.redhat.com/openshift), I am working in a "preserve all cookies" mode:
Cypress.Cookies.defaults({
preserve: /.*/, // match-all regexp
});
When I run my script - it correctly dismisses the accept cookies dialog that pops up right on the start, and proceeds to feeding in the login credentials. So far so good - but then the accept cookies dialog pops up a 2nd time :(, and this time Cypress doesn't dismiss it and gets stuck because the dialog covers the whole page.
Another peculiarity is that this problem doesn't happen when I run the script from the development environment, when I use "cypress open". It only happens when running the script from the command line, when I use "cypress run". The problem can be recreated in development as well if I switch from Chrome to Firefox. Why is there a difference between the behaviors when using "cypress open" and "cypress run", and when using a different browser? How can I dismiss or prevent the dialog from popping up a 2nd time? We're on Cypress 7.7, but I also tried recreating the problem in Cypress 10 and it happens there too.

How do I Start My Browser (Firefox) the Way Selenium Does?

I've got a Selenium test which crashes my browser (Firefox) whenever it runs. It's just a simple test (login, logout, login, logout, login ... crash) and I can't reproduce the crash when I do the same things manually, so I think the problem is with Selenium itself.
However, the issue could be that my Firefox starts with different options than when Selenium starts it. I could confirm that's not the case if I could start Firefox the exact same way Selenium starts it (eg. without plug-ins, with all history cleared, etc.) ... but I'm not sure how to do that.
Can anyone tell me which options to use to make Firefox run the same way as when Selenium runs it?
I was never able to find out how to emulate Selenium's use of Firefox. I tried using a fresh Firefox profile, but that still seemed to have differences from how Selenium ran Firefox.
Instead I wound up re-writing my test to be two tests, and then it was able to log in/out twice in the first test and once in the second test, avoiding the issue I was trying to debug (which only manifests when I try to log in/out 3 times in the same test).
If anyone can provide a better explanation of how to emulate Selenium's running of Firefox I'd be happy to accept that answer.

Why Selenium starts Firefox in safe mode sometimes (without user pressing Shift)?

I am using Firefox Selenium Web Driver to run automatic tests on a dedicated testing machine, so there is nobody pressing Shift there that would cause Firefox to start in the safe mode. But still several times a day Firefox starts with this safe mode dialog:
Any idea what could be causing this behavior?
Multiple tests are running at the same time, so there are several Firefox instances, can they maybe influence each other somehow?
I have disabled automatic safe mode after Firefox crashes as described here, but without success.
The reason is that some of my tests are running external AutoIt script that is "pressing" a Shift key to enter upper case letters. If another test is starting its Firefox at the same moment, Firefox detects the Shift key and displays the Safe Mode dialog.
osdHotkey simple utility that displays and logs pressed keys helped me to find out what is going on.

Why does Selenium Webdriver start failing tests if I focus off its FireFox window?

I have some SeleniumWebdriver/TestNG tests that Im successfully running on FireFox. If I am watching the tests run, it is okay.
But If I start using another browser in the meanwhile, or skype for example, and I go back to the FireFox window that is running the tests, I always find out that some error has occurred - for example, the "User name" input hasnt been filled out.
Why does this happen, and how can I prevent it?
Try to use driver.switchTo().window(driver.getWindowHandle()); when filling out the form.

Why isn't Selenium capturing my keystrokes?

I'm trying out the recorder of the latest Selenium IDE Firefox extension on win32/ff3.
On one page, currently I have to hit Enter to go to the next page, but it's not on a submit button, it's captured manually. This is not picked up by the recorder. I know I can enter it manually myself after recording, but why isn't this part of it?
From the Selenium FAQ:
http://wiki.openqa.org/display/SIDE/FAQ
"Not every event will be recorded by Selenium IDE. Usually the ones that won't be recorded are those that involve complex HTML and/or AJAX. We hope to improve this over time, but there will always be situations where the IDE can't record everything because it has to balance recording too little with too much."
Have you tried with a different browser? Does it happen the same in FF2, IE ?
Use the latest nightly version. I know that there are some problems with FF3.

Resources