- HemaPen
- Posts : 7
Join date : 2013-06-20
To select an element inside a folder in a Tree structure UI uisng selenium web driver calls
Mon Jul 22, 2013 6:55 pm
hi,
We have to do automation for testing our product which is a web based UI product. It has a tree structure just like windows explorer.
Folder1
->element1
->element2
When the software comes up, Folder1 is not always open(double clicked state).
If it is not open I want to double click so it opens.
How do I check if it is already open? Because if it is already open and I do double click it closes the folder.
secondly: How do i get the element Element1 and right click on it to select one more option?
I tried to get findElements(by.xpath(of Folder1)); which is returning null.
I also tried findElement(by.xpath(of element1)); which is not working. it says un selectable element, as that element unselectable=on.
My requirement is open the Folder1, right click on element1 and select 4th item in the menu.
Any solution will be highly appreciated.
I figured out that contextClick doesnt work with chrome driver, have to wait for Chrome version 30+.
So now I have switched to firefox driver. I get the context menu, have about 9 options grouped into
4, 2, 3, 1... I wanto select 6th conext menu option.
This is what I am trying to select 6th item by sending 6 ARROW_DOWN.
newAction.contextClick(pgmFolder).sendKeys(Keys.chord(Keys.ARROW_DOWN, Keys.ARROW_DOWN,Keys.ARROW_DOWN,Keys.ARROW_DOWN,Keys.ARROW_DOWN,Keys.ARROW_DOWN,Keys.RETURN));
What is happening is irrespective of how many ARROW_DOWN I send it only selects 4th option.
Any clue as to what is happening?
We have to do automation for testing our product which is a web based UI product. It has a tree structure just like windows explorer.
Folder1
->element1
->element2
When the software comes up, Folder1 is not always open(double clicked state).
If it is not open I want to double click so it opens.
How do I check if it is already open? Because if it is already open and I do double click it closes the folder.
secondly: How do i get the element Element1 and right click on it to select one more option?
I tried to get findElements(by.xpath(of Folder1)); which is returning null.
I also tried findElement(by.xpath(of element1)); which is not working. it says un selectable element, as that element unselectable=on.
My requirement is open the Folder1, right click on element1 and select 4th item in the menu.
Any solution will be highly appreciated.
I figured out that contextClick doesnt work with chrome driver, have to wait for Chrome version 30+.
So now I have switched to firefox driver. I get the context menu, have about 9 options grouped into
4, 2, 3, 1... I wanto select 6th conext menu option.
This is what I am trying to select 6th item by sending 6 ARROW_DOWN.
newAction.contextClick(pgmFolder).sendKeys(Keys.chord(Keys.ARROW_DOWN, Keys.ARROW_DOWN,Keys.ARROW_DOWN,Keys.ARROW_DOWN,Keys.ARROW_DOWN,Keys.ARROW_DOWN,Keys.RETURN));
What is happening is irrespective of how many ARROW_DOWN I send it only selects 4th option.
Any clue as to what is happening?
Re: To select an element inside a folder in a Tree structure UI uisng selenium web driver calls
Mon Sep 16, 2013 7:26 pm
is it possible for you to provide website URL?
It would be helpful..You can send me in private mail..
It would be helpful..You can send me in private mail..
- mail2prassadAmateur
- Posts : 41
Join date : 2013-06-05
Re: To select an element inside a folder in a Tree structure UI uisng selenium web driver calls
Tue Sep 17, 2013 8:06 pm
Mostly the tree structures are built using client side libraries like JQuery or by ajax calls, also it varies with the implementation. the elements may be present with null values or the elements may be dynamically generated (DHTML).
Here findElements(by.xpath(of Folder1)); returns null, this may be because you are trying to look at the elements even if the folder structure is closed. you can only query this only if the the folder is open. Add a check to see if the folder is open.
Regarding the 4th option selection, it is not clear how the elements are grouped. It looks like the control is not going to the next group. the first group contains 4 elements, second group contains two elements, so to select the 6th element, you need to go to second group and click on the last element. It looks like the control is ending up in first group and clicking on the last element (4th element) because there is no 6th element. Try selecting 2nd or 3rd element, it should work fine.
You may need to modify your code so that the control goes to the next group to select the required option.
Best,
Prassad
Here findElements(by.xpath(of Folder1)); returns null, this may be because you are trying to look at the elements even if the folder structure is closed. you can only query this only if the the folder is open. Add a check to see if the folder is open.
Regarding the 4th option selection, it is not clear how the elements are grouped. It looks like the control is not going to the next group. the first group contains 4 elements, second group contains two elements, so to select the 6th element, you need to go to second group and click on the last element. It looks like the control is ending up in first group and clicking on the last element (4th element) because there is no 6th element. Try selecting 2nd or 3rd element, it should work fine.
You may need to modify your code so that the control goes to the next group to select the required option.
Best,
Prassad
- Sponsored content
- Chrome driver's ChromeOptions persisting across calls - Python selenium bindings
- Select the “back” button of the Firefox browser to right click and Select the Option from the right click Menu in Selenium Web Driver - Java
- How to select an item from the Drop Down combo thru' selenium web driver
- select an element based on another element
- Selecting a option tag inside a select menu
Permissions in this forum:
You cannot reply to topics in this forum
|
|