"result is null" error when working around _blank deficiency in Selenium IDE - selenium

Using a workaround to be able to check the contents of a new tab, I get unexpected results. If I play the test case, the following line fails:
storeEval | javascript{"selenium.browserbot.getCurrentWindow().open('', 'my_window')"} | my_window
with the following error message:
[error] Threw an exception: result is null
The following alternative statements show the exact same symptoms:
getEval | window.open("", "my_window")
getEval | selenium.browserbot.openWindow("", "my_window")
Now, if I double-click it, it doesn't fail, but it opens up a new window, which I think the original solution didn't intend (the next step is to click on a link in the parent window, after all). At this point I can click on the parent window, manually run the next step to launch the link, manually change back to the child window (selectWindow | my_window says it can't find that window), and manually run each of the following steps to check the contents of the new window.
How do I proceed from here to make the test properly automatic?
Update: There is a built-in action for opening windows, but it also fails. Maybe this verbatim log output can shed some light on what's going on:
[info] Executing: |store | license_window | windowName |
...
[info] Executing: |openWindow | | ${windowName} |
[error] Unexpected Exception: fileName -> chrome://selenium-ide/content/recorder.js, lineNumber -> 74
The relevant lines from recorder.js:
66: window.open = function(url, windowName, windowFeatures, replaceFlag) {
...
74: if (result.wrappedJSObject) {
75: result = result.wrappedJSObject;
76: }

It seems that your browser doesn't allow pop-up for your web site. Go to options > Content > Exceptions for block pop-up windows and add your web site address.

Related

replace the kscreenlocker_greet

Sorry my English language
I need the following
If you launch the menu -Start -> Shutdown -> Lock
Then you can see the lock screen
Now press CTRL + ALT +F2
let's log in to this terminal under the root user
And let's see the running processes ps -eH | less
We will see the process tree, and who started whom
You can find the following
ksmserver -> kscreenlocker_greet
If you look at how kscreenlocker_greet was launched using ps -aux | grep greet
Then we will see the following
/usr/libexec/kf5/kscreenlocker_greet --immediateLock --ksldfd
Is it possible somewhere (I hope it's not hard code) to replace this command with another command or an application being launched? And if so, where can it be found? Very necessary!
I would like to replace the command call with another application.

Running while loop to open new chrome window

I am running Selenium IDE and trying to write a while loop to open a new chrome window after closing one. I had several attempts with select windows but still unable to run the loop repeatedly.
Here is what I have:
Error:
while on ${var}<=2 Failed:
A window was not selected after closing the previous one, aborting playback.
This error appears because of wrong iterator. execute script | ${var} +1 | command doesn't increase variable var. This command should be replaced with execute script | return Number(${var}) +1; | var
Also You forget to select root window after closing new tab. So after the 10th command should be added select window | handle=${root} |

Selenium finds element only when I manually click Execute

I need to click on the button automatically. Code:
<tr>
<td>click</td>
<td>css=button</td>
<td></td>
When I click "Play current test case" it does not finds the element. But when I click "Find" after that - it does, and if I click Execute - it clicks on it!
Log:
[info] Executing: |click | css=div.sometag > p | |
[info] Executing: |pause | | 2000 | // Same error with pause & without it
[info] Executing: |clickAndWait | css=button | | // Auto executing
[error] Element css=button not found // Fails
[info] Executing: |click | css=button | | // I click on "Execute" manually - OK!
Why?
Have you tried to insert "waitForElementPresent|css=button|" before the click statement? This might help.
You actually need to use the class selector. So either div.button or .button, otherwise selenium probably is looking for an ID or an element name.
You could also try using a different type of locator, such as ID or XPath.
If we were able to see the HTML of the page you are interacting with, we could provide exact examples.

Keeping the focus after opening a new window in the Selenium IDE

I'm having a problem retaining the focus after using the openWindow command in the IDE. This problem only applies when a second test case within the same test suite tries to interact with the newly-opened window. For example, I have a test suite consisting of separate test cases to do the following:
Log into site A
Enter some transactional data
Submit the transaction for approval
Open a new window and log into site B
Approve the transaction in site B and close the window
Continue processing the transaction in site A
If I do the test case 5 "site B" actions in the same test case as the "openWindow" (ie. merge test cases 4 and 5) then all commands execute without error. If I do the same actions in a different test case then the new window loses the focus and all Selenium commands are directed back to the original window.
The interesting part of this is trying to identify and reselect the "new" window in step 5.
Executing "selectWindow name=siteB_URL" in test case 5 results in the error message "Window does not exist. If this looks like a Selenium bug...".
I then figured I'd call storeAllWindowNames and echo the results to at least see the window names Selenium knows about at various points. If I do this as the last two commands in test case 4 I get the expected result - "echo ,siteB_URL" is logged. If I do the same thing as the first two lines in test case five I get "echo ". This is the part that gets me - simply changing test cases seems to lose the reference to the new window.
Has anyone come up with a workaround or solution to this problem in the Selenium IDE?
I've spent several hours this morning scouring the web and various forums looking for suggestions to no avail.
Thanks in advance,
Glenn
4-7-12 - Update - here's a simplified example of the scenario above:
[info] Executing: |openWindow | http://www.google.com.au | google2 |
[info] Executing: |selectWindow | google2 | |
[info] Executing: |storeAllWindowNames | allWindows | |
[info] Executing: |echo | ${allWindows} | |
[info] echo: ,google2
[info] Changed test case
[info] Executing: |storeAllWindowNames | allWindows | |
[info] Executing: |echo | ${allWindows} | |
[info] echo:
[info] Executing: |selectWindow | name=google2 | |
[error] Window does not exist. If this looks like a Selenium bug, make sure to read http://seleniumhq.org/docs/04_selenese_commands.html#alerts-popups-and-multiple-windows for potential workarounds.
Have you check it with following commands?
selectFrame | relative=up
selectFrame | iframe name
Try with option:
selectWindow()
Just provide the window title name within ().
For Ex:
Window Title is Testing, then
command : selectWindow
title : Testing
To know the title of the newly opened window follow the steps:
Go to the new window
Right click->view page source
Press ctrl+F.
Type title and search.
You will get the title of the new window.
I hope this helps...
Thanks
Sathiya
//on the original window...
command: store window handle
target: myVar
//...do whatever...
command:select window
target: handle=${myVar}

Selenium IDE regex gives error "Threw an exception: missing ) after argument list"

In my test case I am trying to capture the dynamic state id from the url of current web page.
My Selenium IDE code is:
storeLocation | myLocation
echo | ${myLocation}
myLocation returns https://stage.abcx.com/ui/States/ManageTitle.ddx? action=view&stateid=76702
storeEval | re=/^sid/;re.exec(${myLocation}) | new
echo | ${new}
The error I keep getting is
[error] Threw an exception: missing ) after argument list
I have searched the net to find what's wrong with my code but could not figure out the issue.
Am new to Selenium and regex would appreciate any help.
Thanks!
You can try to replace
storeEval | re=/^sid/;re.exec(${myLocation}) | new
with:
storeEval | /\\d*$/.exec(storedVars['myLocation']) | new
new will contain all last digits from myLocation. Some info about the difference between ${x} and storedVars['x'] can be found here.