WinAppDriver icon indicating copy to clipboard operation
WinAppDriver copied to clipboard

how to get list text?

Open YeonwooJeong opened this issue 3 years ago • 3 comments

I tried to get all the file names on this list.

image

xpath String folder_listview = "/Pane[@ClassName="#32769"][@Name="데스크톱 1"]" + "/Window[@ClassName="CabinetWClass"][@Name="snyc2"]" + "/Pane[@ClassName="ShellTabWindowClass"][@Name="sync2"]" + "/Pane[@ClassName="DUIViewWndClassName"]" + "/Pane[@Name="셸 폴더 보기"][@AutomationId="listview"]" + "/List[@ClassName="UIItemsView"][@Name="항목 보기"]" + "/ListItem[@ClassName="UIItem"]";

Why can't read the list? It was a code that worked normally on other routes.

my code ` String folder_listview = "/Pane[@ClassName="#32769"][@Name="데스크톱 1"]" + "/Window[@ClassName="CabinetWClass"][@Name="snyc2"]" + "/Pane[@ClassName="ShellTabWindowClass"][@Name="sync2"]" + "/Pane[@ClassName="DUIViewWndClassName"]" + "/Pane[@Name="셸 폴더 보기"][@AutomationId="listview"]" + "/List[@ClassName="UIItemsView"][@Name="항목 보기"]" + "/ListItem[@ClassName="UIItem"]";

	System.out.println("---------1---------\n");
	List<WebElement> sync_list_elements = (List<WebElement>) winapp.findElementsByXPath(folder_listview);
	int size = sync_list_elements.size();
	System.out.println(size);
	//목록 모두 list에 추가하기
	for (WebElement e : sync_list_elements) {
		list.add(e.getText());
		System.out.println(e.getText());
	}
	System.out.println("------------------\n");`

check 01:10 in video

https://user-images.githubusercontent.com/8816386/173310556-fc54aed1-2299-44de-8108-882ae0f7d927.mp4

YeonwooJeong avatar Jun 09 '22 10:06 YeonwooJeong

Why are you using winappdriver for this? You can get the list programmatically?

anunay1 avatar Jun 14 '22 18:06 anunay1

Why are you using winappdriver for this? You can get the list programmatically?

yes,I'm going to compare the list of local files with the list of files on the server.

YeonwooJeong avatar Jun 15 '22 01:06 YeonwooJeong

https://docs.microsoft.com/en-us/dotnet/api/system.io.directory.getfiles?view=net-6.0

liljohnak avatar Jun 15 '22 02:06 liljohnak