UI Automation

Created at 05 Nov 2018, 14:24
How’s your experience with the cTrader Platform?
Your feedback is crucial to cTrader's development. Please take a few seconds to share your opinion and help us improve your trading experience. Thanks!
12

1222Ht

Joined 11.11.2017

UI Automation
05 Nov 2018, 14:24


Hi , Thank you for reading my question . 

Im quite new to programming, sorry if my question is only some simple setting problem..

I read a really old post thats something to do with UI automation  - https://ctrader.com/forum/suggestions/3865

in the post its said that ctrader doesnt support UI automation ,

however very recently i was using inspect.exe and found "IC Markets cTrader 3.0 window" then i started looking at the automation elements inside it.

In the chart , when you right click :  the context menu allows you to place buy stop orders, sell stop orders, buy limit orders, sell limit orders base on your cursor position and price . I found the corresponding automation elements for them. However , since the context menu is hidden , i have to firstly right click to pop the menu up .

My problem is that whichever side up/down i first pop up the menu . (the two order type that the context menu contains ):

then inside inspect.exe  these two elements nodes contain text of them; but then the other two has no text  (empty)

 ie .  when context menu has [buy stop, sell limit] the two menu items contain text  but then ,  nodes thats supposed to contain sell stop and buy limit text    becomes empty .  

1.

I then have to close ctrader and restart , and this time if i pop the context menu at the lower side .   the nodes contain text of sell stop, buy limit   ---------------  but then the other two becomes empty . 

2.

it remains like this until ctrader is closed and reopened next time . 

At the moment i am using :


       AutomationElementCollection    AEC = ContextMenu.FindAll(TreeScope.Descendants, new PropertyCondition(AutomationElement.ClassNameProperty, "MenuItem")); 

AEC[2] for the sell stop button and  ;   AEC[4] for the buy stop button ;  to locate the button , but i dont know if the index would change anytime 

 

this problem happened to me today , last week i was still able to locate the button by the text that they each carry, ( all four nodes carried text ) and use IsInvokePattern. 

Would uninstalling and reinstalling solve this problem or any setting i can change 

Thank you very much for your time .

Many Thanks 

 

 


@1222Ht
Replies

PanagiotisCharalampous
05 Nov 2018, 14:35

Hi 1222Ht,

I would not advise you to use such methods as they are not officially supported. Element names could change at any time.

Best Regards,

Panagiotis


@PanagiotisCharalampous

1222Ht
05 Nov 2018, 14:56

Thank you very mcuh for your reply .

 


@1222Ht

GammaQuant
23 Nov 2018, 20:37

Hi Panagiotis Charalampous is trhere any chance that you guy can addd UI automation to the API so we can control cTrader UI elements and charts from code? this is something im verty interested in as well. Thank you


@GammaQuant

PanagiotisCharalampous
26 Nov 2018, 11:18

Hi GammaQuant,

I would suggest that you post this suggestion on UserVoice and if it gets enough demand, the product team will consider it.

Best Regards,

Panagiotis


@PanagiotisCharalampous