I think there are too many moving parts. If you really need selenium and everyone else - well - that's fine. However, I would start with something as simple as possible.
In Python 2.7, I used mechanize - this way I was able to simulate all communication with the server. This is not the best option today, since python 3.X is the way to go. I will tell you how I worked with such problems. Just to give you a better picture, and then I will try to describe the possible tools.
Such a typical case was logging in, turning the page, turning on some switches and starting the download, or loading the contents and processing it using a beautiful soup . First you need to know what information is exchanged. Go to the development tools in your web browser and select the network tab. You may know this, but this step is a must, and I should write a general answer. Then do your normal work - just log in and do other things. Everything that the server takes care of must be transferred, so you can see it as network requests. The mechanization was good since I was able to prepare a dict and sent it as a post request to the page. Writing post - a typical mistake - posting to the page address . Therefore, if you visited index.html , you post on this page, while the server expects it to be sent to add_user_data.html , and after that you redirect the goods. Things like a session identifier can be supported by entering a header or cookie - just look at the network link for the template.
As I already wrote, Python 2.7 will be discontinued. The mechanism is not available for Python 3.x, so you need to use other tools. You can look for alternatives to mechanization and see what is good for you. The typical answer is scrapy . This is a slightly different tool used more to remove web pages. Therefore, if you are planning something more, perhaps this is the best option. If you need a single script - I would start with httpie . Command line tool / python package, good OSX support, you can submit the form , session management . I use it every day, however my server is stateless.
I would be happier to provide accurate examples, but without server information, which is not possible. Can you dump your test session? Anonymize it, and I will provide a sample sample, or maybe another tool can be too much?
Michał Zaborowski
source share