Going back to the main page after closing the pop up window - python-2.7

I am having a problem on handling the pop up windows in robot framework.
The process I want to automate is :
When the button is clicked, the popup window appears. When the link from that popup window is clicked, the popup window is closed automatically and go back to the main page.
While the popup window appears, the main page is disabled, and it can be enabled only when the link from the pop up window is clicked.
The problem I have here is that I cannot go back to the main page after clicking the link from the popup window. I got the following error.
20140604 16:04:24.160 : FAIL : NoSuchWindowException: Message: u'Unable to get browser'
I hope you guys can help me solve this problem.
Thank you!

I had the same issue and here is the method to resolve the issue
String window = driver.getWindowHandle();
Now click the button to invoke the popup and give some wait time
and then switch to ur new window with the below code
driver.switchTo().window("your new window name");
//perform your action in the new window and then
To get back control over your main page after the popup closes, use the below code
driver.switchTo().window(window);
This will help you activate the main window and continue your action there.
Let me know if this helpw

No idea in Python but in Java you can use below code after pop opened to solve your problem:
Object[] parentHandle = myDriver.getWindowHandles().toArray();
myDriver.switchTo().window((String) parentHandle[0]);
In the first line of code parentHandle is the number of current
windows in Array form. And in second line of code I am switching to
the first window, for second window you can use 1.
If still have problem or you need something else, please suggest.

I have seen this issue and found that there is a recovery period where Selenium does not work correctly for a short time after closing a window. Try using a fixed delay or poll with Wait Until Keyword Succeeds combined with a keyword from Selenium2Library.

Related

How can I Close a popup window, after execute Update SQL. (Oracle APEX 21.1)

I created a pop-up page. That pop-up window has a radio button, a text box, and an execute button. I want to work that page working like... when pressing the button, run a update SQL with the values of the radio button and text box, and close itself.
I tried that answer in the following link. But the pop-up page just reloaded and the page stayed open. How to close popup window in Oracle-apex?
If possible, I would like to validate the value of the text box. If it was an incorrect value then break the process with a message. If path that validation, run a update SQL and close the pop-up window.
Thank you for your kindness for read this confusing question.
You should be using a "Close Dialog" process type after your Save Process.
Make sure that you also set the server side condition accordingly so that the dialog only closes after your save process.
I GOT RESOLVED IT!
Not use any close method, redirect util is fine work like this APEX_UTIL.REDIRECT_URL (APEX_PAGE.GET_URL(p_page => 7));
Thank you to all ppl for look this page :)

How to programmatically close wxMenu used as popup menu via `wxWindow::PopupMenu` in wxWidgets?

I have a set of instances of plotting view that's added/removed dynamically according to incoming signals from tcp port from another process.
In each instance, the user can right click to open a popup menu, invoked via wxWindow::PopupMenu.
If the plotting view instance is to got shutted-down dynamically while the popup menu is visible, the view instance window is closed while the popup menu is still floating. Then any GUI action crashes the application.
I've been going through the APIs for wxWidgets to find a way to programmatically close the popup menu in the plotting view destructor, but with no-luck.
I found this forum post suggesting it's an impossible thing to close the popup menu programmatically. But it's too old, so not sure if it's still valid assumption.
Here are the trials that failed till now :
Trying to call SetFocus and SetFocusFromKbd on the plotting view as a way to move focus.
Generating mouse left click event and send it to the popup menu.
Generating a keyboard event and send it to the popup menu.
PlottingView::~PlottingView()
{
cout << "Sending wxMouseEvent to the popup menu" << endl;
wxMouseEvent e(wxEVT_LEFT_UP);
this->GetPopupMenu()->ProcessEvent(e);
wxKeyEvent ke(wxEVT_CHAR);
ke.m_keyCode = WXK_DOWN;
this->GetPopupMenu()->ProcessEvent(ke);
ke.m_keyCode = WXK_RETURN;
this->GetPopupMenu()->ProcessEvent(ke);
// the rest of the destruction
}
So I will appreciate any idea to programmatically close this popup menu.
Platform:
CentOS: 6.7
wxWidgets 2.8.12
G++: 4.3.3
Edit #1
Note: For commenters and answers suggesting upgrading the wxWidgets version, it's a debate in my team for everyday. But the answer is still no.
Most of the trials has failed. But I found a workaround to stop crashing but the popup menu don't close.
The solution was to nullify the following members using their setters, so the menu callback won't access them.
this->GetPopupMenu()->SetInvokingWindow(NULL);
this->GetPopupMenu()->SetEventHandler(NULL);
The best is probably to delay destroying the underlying window until PopupMenu() returns. As it is, your program logic is very convoluted because you're dispatching the event which results in closing of the window from inside PopupMenu() function and this just can't end well, even if you could use wxUIActionSimulator to close the menu (but you definitely should consider upgrading your 15 year old wxWidgets version in any case).

CWnd::SetRedraw(False) make mouse go throught window

So I have a MFC application which flick when we do some action.
So I figured I would set SetRedraw(false) and set it to true at the end of the function.
The application doesn't refresh anymore but if I click on it while SetRedraw(false), my cursor is not catched by my application, it goes throught it and set focus on the application below.
Anyone has some kind of idea how I could fix that.
I ended up using CWnd::LockWindowUpdate instead after some research.
It freezes the update but doesn't act if the window was transparent.

No error window in Dev cpp

I am sorry for this silly doubt.
But when I compile this program, it only shows error line. It does not show error window.
(I have purposely made an error here, I know the correct solution in code ).
I tried view section in menu bar, but couldn't find the solution.
Any settings help will be appreciated.
No need to be sorry.. it happens..
Right click the status bar
Click on floating report window.
A movable window will come up.
Click on the inner tabbed close button. (You may have to right-click the report window to resize it and see the close button)
After that just randomly resize the window so that it doesn't hide again.
Happy Coding..!!!
Edit - As #Alex suggested in one comment below -
You probably hid Error window while you were changing it's size. So it's hidden between Editor window and Statusbar. Try to close Statusbar first (right mouse click -> Statusbar) and then stretch Error window to normal size (click and pull lower window bound up).
This also works. :)
Click the "View" at the top of the window.
Then Click on the "Floating Report Window".
A floating window will appear at the botton of the screen.
Then Resize that floating Window.
At last click on the inner tabbed close button.
simple!
Goto "view" at the top of the window.
A whole bunch of options shall drop down.
Check "floating report window".
Thats it!
I had same problem. If you restart your devcpp you will see report bar(including compile log). But if you try to click it it will dissapear. The problem is that this window is shrunk in size to a bar. All you need is just after restarting devcpp click and stretch this bar to small size window.
Go to Tools menu then select Environment Options
then go to compilation progress area, check the Show during compilation option and uncheck the Auto close after compilation option.
I tried all of these answers, couldn't find it yet. I tried pressing the F key buttons and it popped up. So all that needs to be done is press F2!
Go to view
Click 'floating report window'
A long 'Report Window' bar will come out, just resize it and you'll see the compile log.

asp repeater itemcommand not working on second click

I have a repeater which I bind the data using Bind method from the database. There is a Asp:Button with an onclientclick and onclick event. In OnClientClick I open a new window and onclick I am adding the data to the database. This works perfectly on the first Page load. After first click on any of the buttons in the repeater, the click events stops working on subsequent clicks.
I have spending hours on finding a solution for the same, can any one guide me where i am going wrong what needs to be done.
P.S: My application is AJAX Enabled , using WCF and JQUERY
Thanks & Regards,
Phani...
Never Mind I got it solved my self. For others who are trying to solve the same issue, here is the solution:
The code below opens up a new window with out popup blocker blocking the window
OnClientClick of the button write Javascript like below to open a new window and refresh the parent window (I have to do this as the ItemCommand event was not firing until the page is refreshed)
OnClientClick = "target='_blank'; setTimeout("location.reload(true);", timeout);
Phani...