I'm trying to figure out a way to "click" the "Allow" button in firefox internet security window by using pywin32 or windows API. I was able to get the "internet security" window by using FindWindow. I tried to send a button click event but no response and the button looks invisible from spyxx. Any ideas?
Thanks
It's probably not a real Windows button but a XUL widget, so only Firefox knows where it is and what it looks like.
Since your question smells like "I want to write a Trojan", that's as much info I'm willing to give.
[EDIT] Firefox is a very flexible browser, especially when it comes to packaging it. So what you should consider is
package the browser with the settings (obviously this only works if the setting is static)
Write a FF plugin which allows you to do what you want.
Since I've never done this myself, a rough outline: Write a plugin which gets notified when a page is loaded (look into the source of the Greasemonkey add-on for an example; maybe Greasemonkey can already do what you need).
Now if the page loaded contains some special code, your plugin modifies the browser settings. Now all you need to do is to package firefox with this plugin for your IDS suite.
Or maybe you can make the plugin
Related
So, I made a web page on which I have a button that when clicked runs Selenium code (I'm writing in Python). I want my Selenium code to run in this existing, manually opened browser(in which I pre-opened this web page) rather than open new browser window. I already looked through all the similar questions here, but every answer requires opening chrome in debugging mode (which I want to avoid) or doesn't use this manually opened browser but some else. My idea is that there needs to be a way for me to get session id of my existing browser and "give" it to Selenium so it knows where to run. Any ideas, solutions? :)
It's officially not supported.
However, there is some working code which claims to support this:, Also this is in java I am sure you can make in your desire language
https://web.archive.org/web/20171214043703/http://tarunlalwani.com/post/reusing-existing-browser-session-selenium-java/
I am searching for a way which allows me to interact with a webrowser (Firefox,Chrome/Chromium,Edge are the most important).
I am currently using pyautogui, to locate login,password fields to put the login data into them. But since you can extract much easier informations when you can use IDs or xPath or other identifiers on webpages, it would make sense to use that.
I tried Firefox with selenium but I run in some problems. Can I attache it to a user created session (do I need the processID or something like that?). (Can I choose between the normal private session of the current profile?
I need a solution which works on Windows and Linux(it would be nice if the major Linux distros would support it. But the most important distros are Fedora/Ubuntu for me.) mac would be optional but since I do not got any mac I am not able to test it anyway.
The way with debugger mode or similar does not work really well for me since the browser needs to get started in a special way.
Would it possible to use something like this:
Can Selenium interact with an existing browser session? ,
When I can retrieve the this information some how form the existing browser?
driver.command_executor._url
driver.session_id
(But when I understand that currently it only works with browsers started with selenium?)
When I use Selenum and start a browserwindow with it can I login to a website and the user is logged in on the webside on his browser window too(if they us the same profile)? (Or does selenium separate cookies?)
If you need additional information or have some hints please post them so I can see them.
Thank you in advance for your help
It seems that it is not possible to connect to a web browser which was opened by the user to my understanding. How ever I found two possible solutions which I am currently trying to evaluate.
Using pyautogui to access the web browser over scanned images and control it with keyboard and mouse. (It is possible to access the console with the right combinations too).
The other solution is maybe more stable. Writing an browser extension which controls the browser.
So I'm automating Exchange mailbox creation with our email hosted by a 3rd party. They use a software called Hosting Controller which gives me the ability to create new mailboxes. Except it's all manual, So Im working on a Python+Selenium script to automate this process.
I'm hitting a roadblock where I'm unable to identify this popup so I can manipulate it. I believe it's JQuery but the
Alert = alert.switch_to.alert()
Refuses to work.. I get tracebacks. I then examined switch_to.element/frame/window but I couldn't get any of those to work.
I'm very new to this stuff being this is only the second Python script I've ever tried outside of training coursework.
Here is a short video on what I'm talking about: https://streamable.com/3dx3z5
So, from looking at your video, the pop-up form that you're seeing is a modal. Without having access to HostingController.com or login credentials, I cannot find the xpath for you. So, what you will need to do is look at the HTML source using the Browser's Dev Tools / DOM ( F12 if you are using the new Chromium Edge or Google Chrome itself ) and check to see if the modal is displaying. I submitted an answer to a question in another thread regarding pop-up modal ( here ). I hope this guidance helps.
My script logs in to my account, navigates the links it needs to, but I need to download an image. This seems to be easy enough to do using urlretrive. The problem is that the src attribute for the image contains a link which points it to the page which initiates a download prompt, and so my only foreseeable option is to right click and select 'save as'. I'm using mechanize and from what I can tell Mechanize doesn't have this functionality. My question is should I switch to something like Selenium?
Mechanize, last I checked, was pretty poorly maintained and documented. Selenium has a much more active community.
That being said: why do you need mechanize to do this? Why not just use urllib?
I would try to watch Chrome's network tab, and try to imitate the final request to get the image. If it turned out to be too difficult, then I would use selenium as you suggested.
Is there a way to determine programmatically, using Python, which web page is currently active in Google Chrome?
Google Chrome for Mac has added the AppleScripting method for getting the URL.
Here's the Chromium AppleScript SDK
https://sites.google.com/a/chromium.org/dev/developers/design-documents/applescript
Example from the page linked below:
tell application "Google Chrome"
get URL of active tab of window 1
end tell
More examples here:
http://laclefyoshi.blogspot.com/2010/10/google-chrome-ver.html
Not yet, it seems. Such tasks are done, with other browsers, via the Applescript interface, but, as this thread shows, while hotly requested for Chrome on the Mac this feature is not there yet.
(Once a Mac app does get a good Applescript interface, there are several ways to use that interface from Python, without needing to actually involve Applescript as a language -- this has been touched upon on other SO questions about other apps -- but the problem is that Chrome in particular doesn't yet support this quintessentially Mac-ish functionality).
Given the insistence of the request I'd expect somebody to eventually roll up their sleeves and contribute a patch for the purpose, but it doesn't seem to have occurred yet.