Can not click on element via TestComplete object mapping - selenium

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.

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 can I have a button shown in the main view in vs code extensions next to language elements?

I want to write an extension and before really getting into it, I was wondering if there is a way to add a clickable icon with a handlable callback on the main text editor window, next to language elements, for example, right side of function names or variables?
For example, in the attached picture, the green button is rightmost of the window to the function name run(), I want something like that, that the user can click on it. So, anywhere there is a function definition, I could have a button next to that just like the image?

Selenium: How to get text without clicking on tab?

I'm trying to find text that is located on a specific tab. For some reason the text is available in the html but when I use the command driver.find_element_by_id('hand-graph-title-overview').text without clicking on the 'Overview' tab it returns a empty string. However, when I do click on the 'Overview' tab it will return 'Unpaired OOP' successfully. Does anyone know how to get the text without clicking on the tab?
Images of what I'm trying to scrape.
https://i.stack.imgur.com/9nSc0.png
https://i.stack.imgur.com/MyvDA.png
Maybe try and get the 'value' attribute of the element.
driver.find_element_by_id('hand-graph-title-overview').get_attribute('value')
The answer is no. You can't access the element from the other tab without focusing on it. Retrieval of text is totally based on the presence of the element on the current page. When you click on tab then automatically it gets loaded in the dom and then only you can access the element.

Using puppeteer to automate button clicks for every button at every URL in a web app

I am currently trying to use JS and puppeteer to take a screenshot of every url in my web app, as well as take a screenshot of every button that can be clicked. Is there a way to click each button without specifying the id? Not all of my buttons have an id and even if they did, I wouldn't want to have x number of page.click(id, options) for each button I have (which is quite a lot).
Thanks
I have tried going based off each className (this app is built using react) but this does not work. It will take a screenshot of the same buttons over and over. I believe because if page.click has multiple of the same options, it only chooses the first one and many buttons have the same styling classNames.
You could get an array of each element on a page, go through the elements with a for loop determine if it is a button, then click it. Then for each page you'd have to input each url in an array and then use a for loop to go through it.

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.