how to work on a exist session in selenium with python?

2024/9/20 12:02:59

I want to fill some field of a webpage and then send a request to it but this website has a very powerful login page to avoid sending requests for login from a robot so I can't log in with selenium but after login, I can use selenium and I can send requests, on the other hand, I write this program for an app so I can't open a web driver and then work on it
I need to work on a tab that exists

I want to program work on a session that a human opened

Answer

From what I understand from your question is that you want to open an existing browser that is launched by a human.

There are multiple ways to achieve this and as mentioned by Devansh in the comment, You can use the session ID to get the already launched browser and execute your test script on it.

However, there is another way that might be able to solve your issue of executing scripts on already open connection or logged in user.

You can use the profiles of browsers for this scenario, User profiles in a browser are like user accounts on a computer.

You can use the answer to this question to create and use profiles in your script: Opening an existing tab/logged in user using Chrome Webdriver

Now You can manually log in the required account for the website on the above profile you are struggling to log in and then launch the scripts.

https://en.xdnf.cn/q/119329.html

Related Q&A

how to find similarity between many strings and plot it

I have a xls file with one column and 10000 strings I want to do few things 1- make a heatmap or a cluster figure shows the similarity percentage between each string with another one.In order to find …

Python and Variable Scope

So I am recently new to Python, but I seem to be able to program some stuff and get it working. However Ive been trying to expand my knowledge of how things work in the language, and putting this simp…

How to check if element is orthogonally adjacent (next to) to existing elements?

Im trying to make a simple game where a building placed in a nested list must be next to another building. The problem I face is that if the building was placed at the sides, I cant use for loops to ch…

How to add new column(header) to a csv file from command line arguments

The output of the following code:-import datetime import csv file_name=sample.txt with open(file_name,rb) as f: reader = csv.reader(f,delimiter=",") …

Pattern matching and replacing in Python

Im trying to take a string that can be anything like "Hello here is a [URL]www.url.com[/URL] and its great." and be able to extract whatever is between [URL] and [/URL] and then modify the st…

In Python word search, searching diagonally, printing result of where word starts and ends

I have a friend of mine tutoring me in learning Python and he gave me this project where a user will read a word search into the program and the file includes a list of words that will be in the word s…

Selenium python : element not interactable

I am trying to scrape information from this website example website I need to get the version 2021 and search by code. Here is my code: from selenium import webdriver from selenium.webdriver.chrome.opt…

Date into matplotlib graph

How can I use a date from a Sqlite database on the x-axis to make a bar graph with matplotlib?If I convert the date to unix timestamp the graph works, but I would like to get something like this: http…

Non blocking IO - Programming model

In non blocking IO programming model, a thread blocked on data available channels, as shown below, in python,while True:readers, _, _ = select.select([sys.stdin, sock], [], []) # blocked select()for re…

How to globally change xticks label relplot in Seaborn

I am facing an issue to globally changed the x-tick label for plot render using the relplot The idea was to change the int to string x-tick label for both plot. The desired label is [a,b,c,d] However, …