selenium in python Unable to locate element to click continue button

Viewed 92

I was trying to add script to click continue option but its giving me this option what should I do next if anyone can help me.

from selenium import webdriver
driver = webdriver.Chrome("C:/Users/deepak/PycharmProjects/chromedriver.exe")
driver.get("https://www.tppcrpg.net/login.php")

# identify username, password and signin elements
driver.find_element_by_name("LoginID").send_keys("3480199")

driver.find_element_by_name("NewPass").send_keys("12")

driver.find_element_by_class_name("submit").click()

driver.get("https://www.tppcrpg.net/battle_trainer.php")

# identify Enter Trainer Name/Number
driver.find_element_by_name("Trainer").send_keys("2502909")

driver.find_element_by_class_name("submit").click()

driver.find_element_by_class_name("submit").click()

enter image description here

It works fine here but when I add again this line to click continue button

driver.find_element_by_class_name("submit").click()

enter image description here

then this gives me this error

selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"css selector","selector":".submit"}
  (Session info: chrome=90.0.4430.72)
1 Answers

Use the xpath below for continue button. Its working for me

//input[@value='Continue >>']

Code:

driver.find_element_by_xpath("//input[@value='Continue >>']").click()
Related