Greetings fellow scrapers,
I'm trying to use Selenium in Python 3.4 to open a website's clunky interface and get the information I need from it. Sadly, since I need to submit a form (which directs to a different page without bringing up a new window) each time and there is no way to get all of the information in one go. The whole process goes:
"For" all relevant fields: # as of right now, this cannot be a for loop
# because the elements are lost when I submit
(1) click on the necessary buttons (make it visible)
in order to select a field in the form
(2) submit the form
(3) get the necessary information from the new page
(4) go back to the first page
If possible, I would like to find a way of doing this that does not involve me clicking my way to a button each time- that is, I would like to eliminate step (1) of my loop and change step (4) to simply switching windows.
For clarification on how the form is submitted, there is a javascript function within the code that takes care of submission but the built-int Selenium method Element.submit()
still works (so I can either .click()
on the submit button or I can .submit()
from any element in the form).
To make my question clearer, is there a way that the form output can be opened in a new window/tab, whether through inserting javascript or otherwise, so that I don't have to reload the first page and click its buttons so many times?
Please PM me if you would like more specific details about the code and the website, or tell me in an answer or comment if there is any crucial information missing from the question.