Executing JavaScript on a page with urllib - python

I'm trying to create an automation for a site I need to access daily.
I can't install any python libraries at the moment.
I need to set a value into an input. And click on a button on this page.
I already managed to get the page content with urllib. But I can't figure out how to control the page.
It feels like if I could execute JavaScript code on the page my problem will be solved.
Is there a way to execute JavaScript with urllib?
Or any other way to automate a site without external libraries?

Related

How do I package a Python web scraper as a Chrome Extension?

I made an Amazon Web Scraper and I want it work as an extension. What will happen is that it will display the price if it is lower than the previously recorded price. I don't know Javascript. I went through things like Transcrypt but didn't understand much
You cannot. Chrome extensions are written in JS.
The only way to accomplish what you want is to use the extension as a bridge from users browser to your script. You'll need to convert the script into a server of some kind that can accept requests from the extension and respond.

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.

How to interact with windows elements within selenium python code?

What is an easy(simple/clean) way to add few steps to interact with windows based elements within python selenium script?
eg:
Click a download button via selenium driver, change the file name and location and click save button on windows dialog.
Note:
Downloads button is just an example. I pretty much want to know a common way to handle any kind of items.
I do not want a way where they recommend a way to configure browser such that downloads happen automatically at a specific location on our system.
Way to execute my scenario:
Keep this setting turned ON in chrome.
Ask where to save each file before downloading.
Website to try - https://www.seleniumhq.org/download/.
Try downloading anything.
There is a project called Winium, remote driver implementation of Selenium for automating desktop applications. This could help you with this job.
You can spy ui using Inspect.
Find the samples at https://github.com/2gis/Winium.Desktop/wiki/Magic-Samples
Try to use AUTO It, it will be useful in Interacting with windows based applications in selenium.
Check out here - https://www.guru99.com/use-autoit-selenium.html
Hope This Helps You.

I am trying to map python into web page.

I have few scripts written and trying to map those scripts with web page so that any user want to run a script just need to click the button on the web page and script will run at background, output will show on the web screen...
I have no idea how to proceed on this. Can someone help me ??
For you to accomplish this you will need to write some backend code that initiates your script from your webserver. This is because your browser can only run JavaScript. Python would have to run on the webserver.
There are many Python frameworks that can make this task easier such as Django, Bottle and Flask.

how to update wikipages automatically using python scripts

I am using a internal wiki for my projects is there anything available so that I can update my wiki entries automatically using a python script? So that I don't need to go always to the wikipage and edit those pages manually.
Thanks,
Beeth
You could use Mechanize. Using this, you can essentially automate browser activity

Categories