I'm automating the following program via Python: (Surfer)
http://www.goldensoftware.com/products/surfer
Some portions of it i cannot control using win32com.client (the program libraries do not support it). The part i need to get working can be done by using the programs menu bar. It's just 5 clicks i need to get done. So as an alternative i have been trying to use pywinauto (my first try with this). But this time i can not get the menu bar items. I tried analyzing the menus via swapy (https://github.com/pywinauto/SWAPY) but the MenuItems field show up empty (as an empty list []).
here is some test code:
from pywinauto.application import Application
app = Application(backend="uia").connect(process=2984) # tried "win32" as backend also
srf = app.window(process=2984)
srf.menu_select("Help")
I get the error:
"RuntimeError: There is no menu."
The menus I am trying to access are within:
Edit
Arrange
Geoprocessing
Any help will be appreciated.
I finally was able to get the menu controlled via pywinauto:
app_dialog.child_window(title="Menu Bar").set_focus()
From there is was a matter of controlling the keyboard with the SendKeys() module.
It's a workaround but it gets the job done.
Related
I am new in VBA and Selenium. Wrote some lines using Selenium ChromeDriver that can open a online data management system, and log in successfully. I need to manually click on a map, and a table pops up where I need to input some data from a excel sheet using VBA. On that online page, I can access all the components using various methods (e.g., FindElementByName, FindElementByXPath, etc.) **except **the edit boxes and the dropdown elements on the popup table. I even can access the buttons on the bottom of the table. Only when I try to access the elements on the table, it give me the RUN TIME ERROR 7 OUT OF MEMORY. I have attached an image but hid some elements due to the confidential nature of the work. I know it is not a lot of information, but if someone can give me some directions I will highly appreciate it.
Thanks
I am using Selenium Chrome Driver
'Other Subs are here....
Sub Entry()
'I am using these methods to test
myChrome.FindElementByXPath("//div[#class='ui-jqgrid-bdiv']//input[#name='input_ROUTE']").Value = "500"
myChrome.FindElementByName("input_ROUTE").SendKeys "500"
'These throws the Run-time error 7, Out of memory
'However, the same methods works for everything else except the elements on that table
End Sub`
Check the HTML, it is possible that input_ROUTE is inside an iframe element, and the XPath you get is internal inside the iframe.
If this is the case, you need to first move into the iframe and then turn to the internal component. so:
myChrome.SwitchToFrame myChrome.FindElementByXPath("//*[#id=""loginIframe""]") 'Of course you need to change the XPath
myChrome.FindElementByName("input_ROUTE").SendKeys "500"
Working on Coded UI testing and for scripts developed using Record Capture and playback feature (ctrl +I).
The problem is when the page has sub-menus (e.g. I need to hover over menu link then click sub-menu). When I record and capture element using Ctrl+I and executed a script it recognizes, but when I ran the script for the second time the element gets changed and it's not recognized.
I have tried simple x path utility posted here but coudn't able to use this feature. What would be the problem for always element id's getting changed. How to resolve it ?
Are you sure it isn't a nested object?
See http://executeautomation.com/blog/how-to-identify-all-the-child-elements-within-a-page-in-coded-ui-test-cuit/
You could also try EnsureClickable()
There could few reasons behind not recognizing an element:
List item Element is not visible when you are trying to click on it.
If Type of Parent Element is e.g. winclient then it’s difficult in coded UI to identify its child elements.
There could various solutions, you can try:
First Click on Menu Item and then click on Sub Menu Item, if you are directly clicking on sub menu item in your recorded script, this will make sub menu element visible.
Also you can check the visibility from Coded UI Test Builder-> Add Assertion button then going to UI Control Map, then select the element in tree and click on Refresh. It will show if element is visible or not.
If Ids are changing, then you can various other properties like Name, ClassName, InnerText, ControlType, TagInstance, ControlName etc. whichever is supported by Element.
I am trying to automate WPF application (WPF with 3rd party devexpress) using coded UI (VS 2012) in my local machine (Windows server 2008 R2).
I am facing issues while identifying controls under dynamically generated content of the window. I've Tried different hierarchical levels to hit the control,But i am
still not able to hit the control.
Till some level I am getting the handle, but after I am not getting the handle.
My application is complex hierarchically structured with combining winforms and WPF.
I've Tried to use coded UI record and play feature to generate the UI Map and used the same structure to identify the controls. It worked while debugging line by line but it's failing while running.
e.g. Below is one hierarchy,
List item
Dashboard
Dash_Grid
LayoutManager
LayoutGroup
LayoutPanel -->Till this level I am able to get the handle and lower I am not able to hit the control
Container
Navtop
Nav_Grid
TileLayoutControl
........(all tiles)
This issue is not only with one page. I am having the same problem with all the pages.So this is blocking our automation.
Please can any one help me on this?
Try this two possible solutions:
Use the devexpress extension for codedui to identify and locate dexExpress controls:
https://www.devexpress.com/products/net/controls/winforms/coded-ui/
Dont replicate the elaborate hierarchy of your app when identifying controls but instead select the main controls in the hierarchy and use them to set your search properties. this is especially important for dynamically created content where the hierarchy is constantly changing.
in your example:
var List_item = new WpfListItem(parent);
List_item.SearchProperties.. = some search properties
and than set your control's parent to that top list item and ignore the midlle men:
var Container = new UITestControl(List_item);
where UITestControl should be replaced with the controls actuall type.
i m new to MS Coded UI Automating, my Question is.
When i launch my Browser (IE) and fill the detials and then click on submit button. it takes me to new page where i get an error called action cannot be perform on hidden objects
i am using MS 2012 Premium Verison
thanks
Limited information to go on, but have you checked out this the fallowing?
http://blogs.msdn.com/b/visualstudioalm/archive/2013/09/17/coded-ui-mtm-issues-on-internet-explorer-with-kb2870699.aspx
Coded UI error: The following element is not longer availabe
This might be the annoying side effect of Windows Update KB2870699, update 4 for VS2012 is supposed to fix this but an alternative work around is simply to uninstall this update.
We are using coded ui test using visual studio 2010.We are testing .Net 4.0 windows application.
Here is an scenario.
We have an windows app which has a button named submit and we have recorded a workflow which clicks on submit.
Now when we generate code using coded ui the serach criteria for the button is based on its name (display name of button).
If tommorrow developer changes the button's text to submit1 , our scripts fail.
We tried using "controlName"[name given to the control and not the display name] property in search criteria instead of Name , but it does not work.
We get following error - "The playback failed to find the control with the given search properties"
Related problem happens to me also. I solved it by sending the Focus to the UI control before using that control.
Try this.
this.UIAssettePresentationsWindow2.UINOWindow.UINOButton.SetFocus();