Hi Folks,
I am unable to click on a button in a ranorex module on .NET WinForms application using the below methods due to object not identified when executed the test end to end in Ranorex TestSuite.
But when i select that particular step in a module and "Run Selected Item" it's working whereas when executed in a sequence in test suite/module its not clicked.
I followed multiple ways to identify the button object.
1)using Ranorex Recording
2)dynamically getting the buttons from the page
// //Ranorex.Container FormCont = @"/form[@controlname='Portal']/container[@controlname='Portal_Fill_Panel']/?/?/container[@controlname='viewerPanel']/?/?/container[@controlname='dockPanel']/container[@controlname='DockControl']/container[@caption='' and @controltypename='ViewerControl' and @instance='1']/?/?/container[@controlname='dockPanel']/?/?/container[@controlname='TabControl']/?/?/container[@controltypename='UltraTabPageControl' and @instance='0']/container[@controlname='DockTabControl']//container[@controlname='splitContainerBrowser']//container[@controlname='bodyPlugin']//container[@controlname='Panel1']/container[@controlname='GroupBox1']/container[@controlname='Panel2']";
// IList<Ranorex.Button> btns = FormCont.FindDescendants<Ranorex.Button>();
//
// foreach( var btn in btns)
// {
// if (btn.Text.ToString() == "Create")
// {
// btn.Click();
// flag=true;
// break;
// }
// }
// if (flag == true)
// {
// Report.Info("Clicked on Create Button");
// }
Steps involved in my testcase :
a)Logginng into our portal
b)Launch a new tab on a page.{I used wait time for the page being loaded,but when i debugged and see the value of the object it is showing "Timeout"}
c)I want to click on a button in this page.
3) used the below steps before clicking on the button
Validate.Exists(repo.Portal.CreatebtnInfo);
Validate.Attribute(repo.Portal.CreatebtnInfo, "Enabled", "True");
repo.Portal.Createbtn.EnsureVisible();
repo.Portal.Createbtn.Click();
Detailed description of system
Operating system : Win10 Enterprise
Ranorex version : Ranorex 7.0.1
But i am unable to click on Create button when executed in test suite.
Please help me in resolve this
Unable to click on button when executed the test end to end
Unable to click on button when executed the test end to end
Last edited by devarak on Tue Jun 26, 2018 12:27 pm, edited 1 time in total.
Re: Unable to click on button when executed the test end to end
Hi,
At first, please post also a Ranorex snapshot of the problematic button. Screenshot is unfortunately not very helpful. Thanks.
At second, is there a reason why you are using script for clicking one particular button? I would just add Mouse Click action to the recording. Or are there more 'Create' buttons on the page?
Anyway, if you insist on using script, for this particular action, you should add '.' before '/form' string. So the xpath should look like this:
I'm sure this will help
Even better, you should NOT reference an element in code like this. Instead, you should link it directly from repository, by adding repoiteminfo element, as a parameter of your click method. E.g. like this... Where repoElement is the repository element containing the form container, which holds the button you want to click.
At first, please post also a Ranorex snapshot of the problematic button. Screenshot is unfortunately not very helpful. Thanks.
At second, is there a reason why you are using script for clicking one particular button? I would just add Mouse Click action to the recording. Or are there more 'Create' buttons on the page?
Anyway, if you insist on using script, for this particular action, you should add '.' before '/form' string. So the xpath should look like this:
Code: Select all
@"./form[@controlname='Portal']/etc...
Even better, you should NOT reference an element in code like this. Instead, you should link it directly from repository, by adding repoiteminfo element, as a parameter of your click method. E.g. like this...
Code: Select all
YourClickMethod(RepoItemInfo repoElement)
{
IList<Ranorex.Button> btns = repoElement.CreateAdapter<Ranorex.Unknown>().FindDescendants<Ranorex.Button>();
foreach( var btn in btns)
{
...
}
}
Pavel Kudrys
Ranorex explorer at Descartes Systems
Please add these details to your questions:
Ranorex explorer at Descartes Systems
Please add these details to your questions:
- Ranorex Snapshot. Learn how to create one >here<
- Ranorex xPath of problematic element(s)
- Ranorex version
- OS version
- HW configuration
Re: Unable to click on button when executed the test end to end
Hi odklizec,
Please find my comments inline.
At first, please post also a Ranorex snapshot of the problematic button. Screenshot is unfortunately not very helpful. Thanks.
<uploaded the Ranorex snapshot now>
At second, is there a reason why you are using script for clicking one particular button? I would just add Mouse Click action to the recording. Or are there more 'Create' buttons on the page?
<There is no specific reason to use script instead of just a mouse click action instead i was not able to click on the button so tried using the script but still no luck as the object is not identified.>
Anyway, if you insist on using script, for this particular action, you should add '.' before '/form' string. So the xpath should look like this:
<I added '.' before '/form' now.Thanks.>
There are couple of buttons like 'Create' on this page Excess Quantity,SOR Roll,Delete,Add Lines etc..
All these buttons are not identified easily when executed from testsuite but when i highlight them individually its highlighted.
They are able to be clicked when ran individual statements/modules but when executed from test suite end to end it is failed to identify object.
Please find my comments inline.
At first, please post also a Ranorex snapshot of the problematic button. Screenshot is unfortunately not very helpful. Thanks.
<uploaded the Ranorex snapshot now>
At second, is there a reason why you are using script for clicking one particular button? I would just add Mouse Click action to the recording. Or are there more 'Create' buttons on the page?
<There is no specific reason to use script instead of just a mouse click action instead i was not able to click on the button so tried using the script but still no luck as the object is not identified.>
Anyway, if you insist on using script, for this particular action, you should add '.' before '/form' string. So the xpath should look like this:
<I added '.' before '/form' now.Thanks.>
There are couple of buttons like 'Create' on this page Excess Quantity,SOR Roll,Delete,Add Lines etc..
All these buttons are not identified easily when executed from testsuite but when i highlight them individually its highlighted.
They are able to be clicked when ran individual statements/modules but when executed from test suite end to end it is failed to identify object.
Last edited by devarak on Tue Jun 26, 2018 12:28 pm, edited 3 times in total.
Re: Unable to click on button when executed the test end to end
Hi,
What you've uploaded is not snapshot, but screenshot. It's a big difference Please learn how to create a snapshot here:
https://www.ranorex.com/help/latest/les ... shot-files
In case the snapshot is too big for Ranorex forum, you can use a file sharing service like OneDrive or DropBox and here simply post a link. Thanks.
What you've uploaded is not snapshot, but screenshot. It's a big difference Please learn how to create a snapshot here:
https://www.ranorex.com/help/latest/les ... shot-files
In case the snapshot is too big for Ranorex forum, you can use a file sharing service like OneDrive or DropBox and here simply post a link. Thanks.
Pavel Kudrys
Ranorex explorer at Descartes Systems
Please add these details to your questions:
Ranorex explorer at Descartes Systems
Please add these details to your questions:
- Ranorex Snapshot. Learn how to create one >here<
- Ranorex xPath of problematic element(s)
- Ranorex version
- OS version
- HW configuration
Re: Unable to click on button when executed the test end to end
Hi odklizec,
I am new to Ranorex.Started learning the tool .Thanks for helping me to create the Ranorex snapshot
Here i am enclosing the Ranorex snapshot for the Create button
In the application all the buttons(Create,Add Manual Part,Add Lines,Line Detail,Excess Quantity etc..) shown are not identified when ran from testsuite.Normally they are clicked when ran individual statements.
Is this because of page loading time?for that i am using waitforexists method but didnt work.
or is it because of the data on the page is huge.If so how to handle it?
Thanks for your support.
I am new to Ranorex.Started learning the tool .Thanks for helping me to create the Ranorex snapshot
Here i am enclosing the Ranorex snapshot for the Create button
In the application all the buttons(Create,Add Manual Part,Add Lines,Line Detail,Excess Quantity etc..) shown are not identified when ran from testsuite.Normally they are clicked when ran individual statements.
Is this because of page loading time?for that i am using waitforexists method but didnt work.
or is it because of the data on the page is huge.If so how to handle it?
Thanks for your support.
You do not have the required permissions to view the files attached to this post.
Re: Unable to click on button when executed the test end to end
Hi,
Thanks for the snapshot. From the snapshot it seems you are using Ranorex 7.0.1? It's a pretty old and no longer supported version of Ranorex. I would suggest to try the most recent Ranorex 8.1.2. There were many bug fixes and enhancements done between 7.0.1 and 8.2.1. So it's pointless to debug this problem with 7.0.1. Anything I or anyone else here will eventually suggest, is related to most recent Ranorex version
You may try this xpath:
Eventually this:
Both xpaths should work just fine, both from Recording and Test Suite. Using WaitFor Exists action before actual click action is a very good idea. And I would definitely suggest to start with recordings and repository elements, instead of messing with code and xpaths referenced in code, especially if you are a new Ranorex user.
Thanks for the snapshot. From the snapshot it seems you are using Ranorex 7.0.1? It's a pretty old and no longer supported version of Ranorex. I would suggest to try the most recent Ranorex 8.1.2. There were many bug fixes and enhancements done between 7.0.1 and 8.2.1. So it's pointless to debug this problem with 7.0.1. Anything I or anyone else here will eventually suggest, is related to most recent Ranorex version
You may try this xpath:
Code: Select all
/form[@controlname='Portal']/container[@controlname='Portal_Fill_Panel']/?/?/container[@controlname='viewerPanel']/?/?/container[@controlname='dockPanel']/container[@controlname='DockControl']/container[@caption='' and @controltypename='ViewerControl' and @instance='1']/?/?/container[@controlname='dockPanel']/?/?/container[@controlname='TabControl']/?/?/container[@controltypename='UltraTabPageControl' and @instance='0']/container[@controlname='DockTabControl']//container[@controlname='splitContainerBrowser']//container[@controlname='bodyPlugin']//container[@controltypename='PanelEx']/button[@text='Create']
Code: Select all
/form[@controlname='Portal']//container[@controltypename='PanelEx']/button[@text='Create']
Pavel Kudrys
Ranorex explorer at Descartes Systems
Please add these details to your questions:
Ranorex explorer at Descartes Systems
Please add these details to your questions:
- Ranorex Snapshot. Learn how to create one >here<
- Ranorex xPath of problematic element(s)
- Ranorex version
- OS version
- HW configuration
Re: Unable to click on button when executed the test end to end
Hi,
Thanks for your reply.
I have upgraded to Ranorex version 8.1.2.And now i have a problem while executing, there are no errors on the screen.I have referenced all the dlls i need into my project after converting to 8.1.2.But its breaking the execution immediately.I dont understand where i did the mistake.
And secondly if i want to downgrade again to 7.0 is there any way because its throwing me message you cannot downgrade from higher version to lower version.Please help me.
Thanks for your reply.
I have upgraded to Ranorex version 8.1.2.And now i have a problem while executing, there are no errors on the screen.I have referenced all the dlls i need into my project after converting to 8.1.2.But its breaking the execution immediately.I dont understand where i did the mistake.
And secondly if i want to downgrade again to 7.0 is there any way because its throwing me message you cannot downgrade from higher version to lower version.Please help me.
Re: Unable to click on button when executed the test end to end
Hi,
Unfortunately, without knowing the errors you are getting, there is not much anyone here can do or suggest. Please post the error message(s) you are getting.
As for downgrading 8.x solution to 7.x, it's not possible. However, during the solution conversion, Ranorex creates a zipped copy of existing solution (before conversion) and stores it in the main solution folder. Also, you should be able to obtain the working copy (7.x) of your solution from version control system...I hope you are using one? If not, you should IMMEDIATELY adopt it!!! It's a very bad practice developing TA (any SW) without using version control system.
Unfortunately, without knowing the errors you are getting, there is not much anyone here can do or suggest. Please post the error message(s) you are getting.
As for downgrading 8.x solution to 7.x, it's not possible. However, during the solution conversion, Ranorex creates a zipped copy of existing solution (before conversion) and stores it in the main solution folder. Also, you should be able to obtain the working copy (7.x) of your solution from version control system...I hope you are using one? If not, you should IMMEDIATELY adopt it!!! It's a very bad practice developing TA (any SW) without using version control system.
Pavel Kudrys
Ranorex explorer at Descartes Systems
Please add these details to your questions:
Ranorex explorer at Descartes Systems
Please add these details to your questions:
- Ranorex Snapshot. Learn how to create one >here<
- Ranorex xPath of problematic element(s)
- Ranorex version
- OS version
- HW configuration