Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

getDocument(0) throws IndexOutOfBoundsException #100

Open
krasnyd opened this issue Jan 25, 2019 · 3 comments
Open

getDocument(0) throws IndexOutOfBoundsException #100

krasnyd opened this issue Jan 25, 2019 · 3 comments

Comments

@krasnyd
Copy link

krasnyd commented Jan 25, 2019

I have this code:

UIAutomation automation = UIAutomation.getInstance();
AutomationWindow window = automation.getDesktopWindow("ZAV - 1.0.05");
AutomationDocument ad = window.getDocument(0);
System.out.println(ad.getText());

But it throws this exception:

Exception in thread "main" java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
	at java.util.ArrayList.rangeCheck(ArrayList.java:657)
	at java.util.ArrayList.get(ArrayList.java:433)
	at mmarquee.automation.controls.AutomationContainer.getElementByControlType(AutomationContainer.java:110)
	at mmarquee.automation.controls.AutomationContainer.getDocument(AutomationContainer.java:768)
	at cz.krasnyd.writer.Test.main(Test.java:20)

When I look to inspect.exe (screenshot below), I see there some Document elements and I want get their value. Other functionalies works well (e.g. function getButton) and for example this code:

List<AutomationBase> a = window.getChildren(true);
for(AutomationBase ab : a){
   if(ab.getClassName().equals("WindowsForms10.RichEdit20W.app.0.2004eee")) {
      ...
   }
}

...returns me some Document elements, but I cannot get their value. Don't you know where the problem might be or do I use the library wrong?

*some things are in my local language ("vlastní" = "Custom", "podokno" = "Pane", "skupina" = "Group")
inspect

@mmarquee
Copy link
Owner

mmarquee commented Jan 27, 2019

Hi,
I think you'll have to follow the hierarchy down, getting each level. Not sure that we have a 'Group' control though.
Is this a publicly available program so I can look at it and see whether I can get the control you want?
Mark

@krasnyd
Copy link
Author

krasnyd commented Jan 28, 2019

Hi Mark. I sent it to your email.

@mmarquee
Copy link
Owner

I am really sorry, but I seem to be locked out of the email address and Microsoft won't unlock it. I have changed the email address to my personal one, so if you can resend it that would be super. If not, I'll understand

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants