How to allow clicking on row elements in dynatree - dynatree

I want to render dynatree node with several checkboxes and select any, but when I click on checkbox, happens click on row, how can I disable click on row and enable clicking on elements, located in node?

It is simple. Use from server noLink: true(node title will be span, not a) and don't remove e.preventDefault, because
Make sure that clicks stop, otherwise <a href='#'> jumps to the top

Related

How to unfocus from all inputs/elements in Selenium without tabbing out

I have a form where I fill in textboxes through selenium (java). Some of the textboxes dynamically generate extra content when you click on them and remove the content when you focus on something else. This is a problem when I automate because if I am focused on a text box and try to click on something else, when the page removes the content it doesn't register my click and I need to click again. This leads to flakey behaviour since I need to now consider whether I need to click or double click a button depending on what element I was focused on before.
I can't send a tab key to the text box because sometimes it will tab into another textbox that has the same dynamic generation behaviour, leading to the same scenario as before.
I tried clicking the page element but it also doesn't seem to work. I also tried clicking the root div. It just doesn't seem to register my click (I also tried jsclicks)
What I would like to do is have a general way to unfocus a text box after I fill it.
Thanks!

how to click on radio button which is under a expanding tree node in Selenium

->ABC
. 1
. 2
Here I have select "ABC" first which expands and shows two radio buttons. I have to find this element on a UI page and click on the 2nd radio button.
as for me, to make it simple, I would like to add css class to those radios, so that I can use find_element(css: '.a').click. This is my lazy and yet effective approach.
If both radio buttons belong to same group then they will have same names
You can extract both of them and click on second one
driver.findElements(By.name("common_name_of_radio_button").click();

Find element in desplegable list after doing browser back

I'm scraping a web with the following structure
Menu1
Submenu1
Event1
Event2
...
Submenu2
Event n
...
...
Menu2
....
Where to have access to Submenu you have to click on Menu, so as to expand the node and make submenu list visible, and to have access to Event list the same, you need to click on the corresponding submenu node.
Once you get the event, you click on it and it goes to another page. After you scrape some, you go back to the previous page and scrape the next event. The code would be as follows
browser=webdriver.Chrome()
browser.get(url)
Menu1=browser.find_element_by_xpath('some expression')
Menu1.click()
submenu=Menu1.find_elements_by_xpath('some other expression')
for sub in submenu:
event=sub.find_elements_by_xpath('expression here')
for ev in event:
event.click()
Some scraping
'Go back to previous page'
browser.execute_script("window.history.go(-1)")
After doing the first iteration when trying to do the second for Event2, I get a NoSuchElementException, basically because after going back list are not expanded and therefore not all objects are visible to keep on with the for looping.
Is there any way that suits the code to fix this? My guess is that if I click Menu1 again, all Submenu elements will be visible so that list will be once again available. Afterwards, if I click on sub then the Events list will be available as well.
Eager to read your suggestions
Thanks
So, in esence, what has come to my mind as the solution is generating several list for each menu, with the text of the node. Iterate in for loops instead of nodes, loops of the node names that are unchanging.
Then, for each node name, loop through the object until finding it, and click on that particular item.
Then repeat until you've reached all nodes.

How to close react-select input when user clicks outside of the input?

I'm creating a select input using react-select version 1.1.0.
After I click the right-arrow to open the dropdown list, it doesn't close when I click elsewhere on the page. I have to either select an element or click the arrow again to close the element.
How can I make the dropdown list close when the user clicks outside the select element?
https://codesandbox.io/s/nrmpvw6oll

Can not click on element via TestComplete object mapping

I need to click on a web element, within TestComplete, this element looks like this:
I outlined its boundary using heavy-black line.
The problem is, by default, an element is always clicked in its middle point, and for this element above, clicking its middle point produces no results as it does not click this plus sign.
Within TestComplete, this element can not be broken further down into smaller elements.
I can use Selenium in JavaScript to click it, but is there is an other way?
Thanks
Try using x and y coordinates with the Click method.
SmartBear Click Action
I needed to click a button on my website but TestComplete was only able to identify the parent object which had 3 buttons in it. I was able to use x,y coordinates to press the 3 different buttons in parent object.
Record a script where you click the button and look at the function created to get the coordinates you need.