Page 1 of 1

Popup Watcher cann't push button anymore

Posted: Thu Apr 30, 2020 10:44 am
by Elena_v
Hello everyone!
I have popup Qt windows in project. I didn't change Repository items and their XPath (100% that they are correct) and PopupWatcher worked good. And now all my Qt buttons cann't be find when tests are running. Ranorex is searching... and after 1 min try to run another code (case). Of course, it isn't possible and tests are stopping as failed :x ! Qtversion='5.12.3'. Example of code here :arrow: :

Code: Select all

void ITestModule.Run()
        {
           //regular code at the beginning...
           
	   var myPopupWatcher = new PopupWatcher();            
            myPopupWatcher.Watch(repo.ToSaveWindow.SelfInfo, ConfirmDialog);
            myPopupWatcher.Start();
            Report.Info("Info", "PopupWatcher started.");
        }        
        public static void ConfirmDialog(Ranorex.Core.Repository.RepoItemInfo repoItemInfo, Ranorex.Core.Element myElement)
        {
	   // To save (QMessageBox) > Button Yes (QPushButton) 
            if (repoItemInfo==repo.ToSaveWindow.SelfInfo)
            {                
                repo.ToSaveWindow.ButtonYes.MoveTo();
                repo.ToSaveWindow.ButtonYes.Click();
                Delay.Seconds(2);
            }
        }
I still cann’t push buttons in PopupWatcher.
:!: This recommendations (from forum) don't work with button element:
.CreateAdapter<Ranorex.Unknown>();
.Focus();
.Click();
.EnsureVisible();
.InvokeMethod();
I can Activate parent element (.Activate();), but buttons I still cann’t push =(
:?: Maybe someone knows another way?

Re: Popup Watcher cann't push button anymore

Posted: Thu Apr 30, 2020 11:14 am
by odklizec
Hi,

I'm afraid, it's impossible to tell what's wrong or suggest something without seeing, at very least, a Ranorex snapshot of the problematic element and full xpath (as stored in repository). Ideally, try to create the app snapshot, using Create Snapshot action placed before the typically failing test step.

Also, the popup you want to process with popupwatcher is something that appears regularly or randomly?

Re: Popup Watcher cann't push button anymore

Posted: Thu Apr 30, 2020 1:12 pm
by Elena_v
odklizec, thanks for the answer!

Screenshot of problem button in attach. On 4.jpg you can see that Spy is on the left, and Snapshot is on the right side. Interesting thinks: in Snapshot unknown elements appeared (Button 'CommandButton_6' and etc.), but thez aren't exist. :?:
XPath:
QMessageBox is /form[@title~'Подтвердить сохранение в виде' and @windowtext~'Подтвердить сохранение в виде' and @accessiblename='Подтвердить сохранение в виде']
QPushButton is container/?/?/button[@text='&Да' and @accessiblename='Да' and @class~'Button' and @windowtext='&Да' and @flavorname='win32']
I assumed that maybe there are 2 buttons with the same XPath, so I added more parameters to the XPath. Doesn't help.

Re: Popup Watcher cann't push button anymore

Posted: Thu Apr 30, 2020 1:24 pm
by odklizec
Hi,

Sadly, screenshot are not very useful here. Please post the snapshots. Apparently, from the screenshot it looks, that the number of elements and overall UI structure is different? Therefore, you must update the xpath accordingly. But as mentioned, it's hard to tell without examining both snapshots (from Spy and from recording).

Re: Popup Watcher cann't push button anymore

Posted: Mon May 04, 2020 11:13 am
by Elena_v
I used git -revert and took …\PopupWatcher\.. from master. PopupWatcher ‘ve started to work, but I have to create changes in it again. :|
Thanks for you answer. Hope that I ‘ll not see this bug anymore.