Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
199 views
in Technique[技术] by (71.8m points)

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

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

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...