Clicking NEXT to Images - python

I have had some success automating some work navigating a website lately, but I've had a LOT of difficulty trying to get it to work across multiple systems.
Currently, I am using PyAutoGUI to locate an image of text, and then telling Python to click to the RIGHT of that image in order to select the desired text box. Unfortunately, this isn't panning out to other systems even with lowered confidence intervals for the locateOnScreen() method.
I tried looking into Selenium to locate the text, but unfortunately I would have to run this on an existing IE explorer which is currently unsupported.
I was thinking about using OCR, but I'm unsure of how I would tell Python to click NEXT the the text that I am searching for.
Any input on possible solutions would be greatly appreciated!
-MontX
Edit:
Image of what I've been trying to get PyAutoGUI to recognize.
Example of text I've been trying to locate on screen:
Example of kind of icons I've been trying to locate on screen:

Related

Is it possible to "click" on things with python and selenium that doesnt have a selector when you open inspect

I am trying to write a code that opens a website and performs different tasks. Some buttons don't have any selectors (i believe it is called), when I hover over them with my mouse using the inspect tool, nothing comes up. Is it possible to click on these buttons in any different way using python and selenium? For example by telling selenium to click on specific locations on the screen?

Selenium unable to automate click on web element

I should start by saying that I'm not a web developer but I have been using Selenium with Python for a few weeks and think I've gotten the basics down.
What I have is a page with a weekly calendar on it. Image as follows:
What happens is that you can click on any of the coloured boxes which will bring up a register for a class. It features items that you can click on which bring up new information. The problem I have is that I can't click on the items - or, rather, I don't know how to automate the click. I have automated clicking with Selenium before in other situations.
That looks as follows:
As you can see, the calendar still appears in the background. That is to say, the item we click on doesn't take us to a new page but, I suppose, runs some kind of method which shows the register and populates it with data.
My problem is this: I want to automate the process so that I can click on each of these items then scrape the information. In order to do that I need to be able to automate the clicking for each of the items.
So what have I done? When I've done this before, I've searched through the web html for the relevant part and then grabbed the xPath to the element I needed. But here I can't do that. Why not? Well, firstly, I just can't find that element!
Take a look at this close up of the first column:
It's divided into columns, but then I'd expect the clickable area to be an element within that. As you can see, it's not. Furthermore, the clickable area is just the coloured box itself, but if you look closely you can see the element goes outside of that area. I have gone very close with my mouse cursor to see exactly what's clickable, and it definitely is just the coloured box.
So I've not been able to get the element at all.
I thought I might be able to just find out where we went after I clicked the button, but when I got the link address, it just said it was the same page with no differences.
I appreciate I'm asking quite a broad question here, but the problem is that I don't really know where to start. If someone could give me at least that much, I would be grateful. Like if I could just click on each of these one at a time... I've found where the populated data is so I could grab that without a problem.
Well, here's to hoping.
Edit: I should add that there are some JavaScript items (tag type script, type='text/javascript'). I presume that the answer is in there somewhere, but there is a lot of Javascript and I'm not adept at reading it. It's hard for me to tell what script does what. If I could at least figure out what script runs when I click the item then I think I'd be onto something, but I have no idea. Even that would help me.
I had encountered similar problem when scraping for Instagram followers in mobile view where it was floating box when showing the accounts followers name. The approach I took was identifying the name of floating dialog box and clicking the element in it. It might different in your case of html.
Trying looking at this link. Selenium Scroll inside of popup div
Hard to say without the HTML. Maybe try Katalon Recorder (chrome extension) and see if that can detect the xpath for you? It might also be you have to use some kind of javascript to invoke the method for the element

pywinauto print control identifiers does not show required controll buttons

I'm trying to automate installation (install anyware type) using pywinauto.
When I use function to dispaly controlls "print control identifiers()", I see only buttons like "minimize", "close" , "maximize" and window name. There is no "next button" and other required buttons, that I need for automating this installation.
this is how it looks after using this function:
enter image description here
this is how installer window looks :
enter image description here
code sample:
w_handle2 = pywinauto.findwindows.find_windows(title=u'PTC Solution Installer', class_name='SunAwtFrame')[0]
window2 = app.window(handle=w_handle2)
window2.print_control_identifiers()
Could you pleas help me, with my issue? Is ther any other way to check the controlls? I was also trying to use other software like inspector.exe, it tells me the windows name , but nothing about controlls.
If there is no other way, then maybe there is possibility to use function for clinking mouse, with some additional precision. For example finding specific string on installer window and clicking on it, or getting button string location and passing it, to mouse click coordinates.
Topic Update image with
inspect tool screenshot:
screenshot with inspect tool
winspy screenshots:
winspy screenshot1
winspy screenshot2
winspy screenshot3

Read browser image and click without using selenium?

I was just trying to figure out how to get python to see the browser window and read the image there(I don't want to take a snapshot, if possible) process it and then click the relevant button on screen.
As a project I want to avoid selenium. I can't seem to find the correct library or any tutorials for this. Can someone tell me the library and possibly a tutorial?
I am on Ubuntu.
Thanks

Uploading a file into a popup window with selenium

I have searched the forums and found some information regarding this, but not quite with the problem I'm facing. I am automating the uploading of files to a website. Unfortunately, the website uses a counter for the id of the "browse" button. Using Selenium and Firebug, I was able to find another way to identify the button. I have exported the script into python to add variables so I can automate. However, the browse button opens a windows popup to select the file. The script is started out like this...
driver.find_element_by_xpath("//*[#type=\"file\"]").click()
driver.find_element_by_id("upfile_1405369589849").clear()
driver.find_element_by_id("upfile_1405369589849").send_keys("path\\file")
driver.find_element_by_id("upload_button").click()
In this, the upload button is clicked, the popup appears, and it sits there mocking me. I tried using the xpath in place of the id, but that didn't work. I tried the following, too...
driver.findElement(By.id()).send_keys("path\\file")
and tried this...
driver.find_element_by_id("upfile_*").send_keys("path\\file")
I cant seem to get the window to respond, other than it's mocking glare. Any help to squelch this would be very appreciated.
It can´t be done. One workaround is to get the development team to modify the AUT for you. Add a javascipt function into the page that will allow you to pass the filename to the handler without having to click the browse button.
If you can´t do that, I would suggest that you look into Sikuli that will allow you to interact with the windows prompt using pattern recognition (screenshots) of what you want to interact with.

Categories

Resources