Selenium python plugin and permission issues - python

I am using python and Selenium for a project.
But I am stuck trying to open a web page.
To access this page you require to authenticate and then press a usb device for second factor authentication, but only one time for each browser session.
I always get the page "you did not present a posture cookie. please install or repair your AEA plugin"
Comparing a manual browser it seems to have the plugin.
I have tried the following:
1)Tried by authenticating manually and then saving the browser cookies.
2)I have also tried by adding chrome_options.add_argument("user-data-dir=C:\Users\"+username+"\AppData\Local\Google\Chrome\User Data\Default") that is apparently where cookies are stored but both method fails.
I found the plugin ID, packed the plugin and tried to add the extension to the webdriver, but got the error "Loading of unpacked extensions is disabled by the administrator."
Is there any way to make the os thing that I browsing manually? By searching I fund that the option options.setExperimentalOption("useAutomationExtension", false); used to work on previous chrome webdriver versions, but is not working anymore, and disabling all plugins does not seem to be an option here.
Any advice would be appreciated.

Related

How to run selenium on an actual webserver?

I've no idea on how to do this and all the documentation that I could find by google did not help. A while back I was introduced to selenium through this tutorial and now that I'm more comfortable with it, I want my selenium "bot" to run on a webserver 24/7, receiving orders from me through facebook messenger (something I already did with it running on my local machine).
I tried to find answers online and was overwhelmed by the amount of information, finding nothing that is clear to understand. All the pages I've been through require me to learn about a large array of things and have been very specific about their tools. And some times I try to follow along something just to receive an error I don't understand nor is it explained on said something how to fix it.
I also asked this question on Reddit only to be downvoted without answer. I've no idea how to run selenium + chrome on a server.
Take me for the stupidest person on earth, How can I do this in the most clear steps? I'd prefer to use chrome with selenium, through python or php.
You can try it by making your chromedriver run headlessly. I was introduced to it by this tutorial. a headless browser means a web browser without a graphical user interface. Headless browsers provide automated control of a web page in an environment similar to your local browser and you can get screenshots too.
If headless browser is giving you an error which can't be resolved(like screen sharing error), then you can try aws or Google Cloud like platforms

Programmatically install a chrome extension

I'm trying to install a chrome extension which is available in the Chrome Web Store on a specific chrome profile.
I was trying to do that with Python and Selenium (with the add_extension function) it works, but in reality it only loads it during the program. Indeed, when I click on the google shortcut after the program is finished, the extension is not installed.
I already had a look on the internet (with Chrome API), but there was no answer which fits my issue.
Thanks !

How to access a currently open browsers URL's with python

I'm trying to write a python executable that runs in the background and records the amount of time I spend on facebook. This is one of my first projects in software development. The problem is, I haven't found a way to access the chrome browser and look at what URL's are open.
I've used selenium webdriver, but it seems to only be able to open up new tabs.
I've found some kind of google extension called google tabs api, but i'm not entirely sure if it even is a library I can import into python or if it's even meant for python.

Run iMacros in Firefox via Python

I have process that uses iMacros in Firefox to open some websites and click on some buttons and do some stuff (not any weird stuff, internal work pages). The problem is that I basically can't use my computer while that happens.
I want to automate this via python and found this:
Integrating iMacros scripts into python
However the answer to that question and the links mention that I need the business or enterprise version of it.
Is there a way to just do something like:
Open firefox (I know how)
Use (as a plugin) iMacros to run a iim script in x location
Thanks!!
You can have 100% control over Firefox with Python, as both are open source. The trick is to figure out details. Here are some starting points
Python can script Firefox with Selenium WebDriver
With some tricks, you can dive deeper into Firefox what basic Selenium interaction offers, like opening a web pages. This would include giving direct commands to plugins. Here is an example of settings Firefox profile in a mode that normal security restrictions do not apply.
You need to study Firefox architecture how you can trigger iMacros plugin commands from Selenium. This is the tricky part as this is very marginal use case and there might not be much information available. Expect spending few days of learning Firefox internals.
My guess is that you can disable Firefox security, and then use Selenium WebDriver to run a JavaScript snippet which gives direct commands to iMacros component.

Selenium webdriver using PhantomJs fails to redirect in python

i'm tring to automate an oauth2 authentication for a webcrawler in python, i chose to use selenium as a webdriver for doing so.
i won't have root on the machines that i'm going to use so i chose to use phantomjs as this script need to be headless and so i won't be able to install xvfb in these machines.
now i found out that phantomJS have this bug: https://github.com/ariya/phantomjs/issues/10389
and the oauth2 page i need to use have that kind of redirects, the workaround in these page is in javascript and quite useless to me, there is a workaround (considering these premises) or another solution to be completely headless in python?

Categories