Skip to content
Advertisement

How to move selenium webdriver to next page after clicking submit button?

Web page 1 with submit button (proceed with bookingnew page I want driver at)

So I got to the point where my program fills in the textbox and clicks the proceed with booking button with a submit() command, however in the html there is no url to put in the driver.get([url]) method to move my driver to the next page.

All subsequent methods called on driver are on the “Proceed with booking” page instead of the next page it takes me to. How do I continue the program by moving my driver to the next page?

My code:

#types in studentID
studentIDBOX = driver.find_element(By.NAME, 'MEMBER_NO')
studentIDBOX.send_keys('12345678') #example ID

#submits the proceed to booking button
proceedBox = driver.find_element(By.XPATH, '//*[@id="single-column-content"]/div/div/div/div[2]/div/form/input[5]')
proceedBox.submit()
# WHAT DO I ADD TO DRIVER.GET??

Advertisement

Answer

proceedBox.submit() should submit the <form> and take you to the loggedin page. You won’t have to explicitly invoke driver.get(url). Once the new page loads you can as usual invoke the following commands:

Advertisement