I created an automation program to test a WebSite using Python/Requests/Selenium/BeautifulSoup on a Linux box. The site has a user/login combination (login page) and a security question (next page) controlled by a form.
driver.find_element(By.NAME, "in_user").send_keys(user_name)
sleep(1)
driver.find_element(By.NAME, "in_pass").send_keys(user_pwd)
sleep(1)
driver.find_element(By.ID, "login").click()
sleep(1)
Once logged, a report must be executed/downloaded calling javascript functions
driver.execute_script("navigate('des' , 'reports' , this);")
driver.execute_script("document.frm_report.submit();")
driver.execute_script("create_csv();")
All this is working fine but I wonder if it is possible to create a version just using Requests (or at least not using Selenium) to run it in a server without browsers. I want to avoid keeping my laptop on day and night!!!
I am not so experienced on Requests and cannot figure out how to implement:
Can anybody give me some ideas on where to look for info or docs, in case that it is possible?
Thanks
If you want to test if website is rendered correctly and you can click all the buttons, and execute javascript function you have to use some kind of web browser/engine.
If you want to just test underlaying API endpoint and not user interface you could use something like chrome dev tools or fiddler to record HTTP requests being send and try to mimic them in Python. So first you authenticate to get token that then can authorize your request to create report.