How to re-request on the same route while Flask is running? - python

So I am trying to have program that uses browser automation. I will be using the Selenium package from Python. This will all be in a Flask route in system A.
Essentially I will be doing browser automated commands through Selenium, then sending an output to system B via a get request. I then want to wait for system B to verify that the request sent is valid. Then system B will send a request back to the same endpoint on system A to finish the Selenium process.
Remember I CANNOT use redirects because I have to stay within the same Flask route and Selenium process. I cannot simply just call another function because system A is waiting on system B to send back a request to finish the Selenium process.
Is there a way to do this?

Related

How can i stop outgoing PHP script request via Selenium in python?

I am working with ChromeDriver via selenium Library in python. After loading certain page it gives table, that refreshes itself every 2 seconds via sending response to run php script.
https://someurl.com/getTasks.php?tasks_type=1&from_date=01.06.2021&to_date=01.06.2021
This is screenshot of requests
To work with content of this table i need to block php request immediately. how can i perform this action in python?

Python triggering / simulating Custom Browser Protocol

I want to make a python script that will automatically join zoom meeting at a specified time
when using browser you could use this url zoommtg://us02.zoom.us/join?action=join&confno=1234567890&pwd=Z1hTRjUwampocmR1VEh4aWkrSkZUdz09 to automatically join,
how do I trigger this Custom Browser Protocol directly in a python script without using a browser?
since a browser normally prompt you to www.example.com wants to open this application

python receive push notifications like a browser

Is there a way to make python receive a web push notification like a browser ?
I have a web page with Firebase cloud messaging subscription service ( FCM JavaScript client )
I need to somehow receive notifications on my python program running on windows pc
one idea was to opening a selenium chrome browser and receive notifications trough that but I didn't find a way to receive data from notifications , also I'm trying to log all windows notifications with Auto Hotkey and read the log file for my purpose but neither if this methods are time and resource reasonable
so is there any way to achieve this purpose ?

How to execute actions on web without GUI

I will need to test few things from my linux server. I wonder if it is possible to manipulate some actions on web without access to browser. I have only access to linux server via command line. I know only selenium webdriver to do that actions but but for that I need browser.
What I want to do:
1) Input text to textbox on webpage using python script which is placed on linux server
2) Click button on webpage
Generally it is possible to manipulate actions on webpage from linux using python scripts?
If you input text to fom on webpage and submit the form, the browser will send POST or GET request to the server with contained information. The server then proceses (for example saves ) the information. You dont need a browser to send http request, you can send them directly from python.
AN example can be found here: How to simulate HTTP post request using Python Requests module?
If requests module isn't enough already, try using selenium with PhantomJS. PhantomJS is a headless WebKit scriptable with a JavaScript API.
PhantomJS : http://phantomjs.org
A great tutorial : https://realpython.com/headless-selenium-testing-with-python-and-phantomjs/

Python Selenium WebDriver - Possible to monitor XHR AJAX Calls?

I am using Python with Selenium WebDriver to browse through website.
Now I have the problem that I want to monitor the XHR AJAX calls, thrown on the current site.
For example: I am on a specific page and the python selenium script clicks on a button on this site. This website button calls an AJAX request within this site.
Is it possible to monitor this XHR AJAX request and get it in my python script to handle the called AJAX URL?
Thanks!
UPDATE: I exactly want to do sth like this (but in python obviously)
https://dmitripavlutin.com/catch-the-xmlhttp-request-in-plain-javascript/
You can use browser.execute_script to catch the calls as explained in the link that you mentioned. In addition, start a fake website using Django on a separate thread. And in the JavaScript handler (sendReplacement), replace the url with the one of your django server.
In that server you will receive the AJAX call and be able to examine it.
You may be able to implement a simpler solution without the django server by simply monitor the calls directly from the JavaScript snippet and make it return the value you want directly. But if you need to monitor many calls and perform more complex examination is the requests, the former solution is more powerful.

Categories

Resources