1

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)
3
  • I think the script needs to wait before you click last submit. would you try to put some sleep or wait? Commented Apr 18, 2021 at 16:05
  • i tried to add sleep script but it gives me integer error problem Commented Apr 18, 2021 at 16:58
  • 1) You should send the text to driver.find_element_by_name("LoginID").send_keys("2502909") element instead of driver.find_element_by_name("Trainer").send_keys("2502909") But I do not understand why don't you fill the password and why are you clicking the submit button twice? Commented Apr 18, 2021 at 17:15

1 Answer 1

1

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

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

Code:

driver.find_element_by_xpath("//input[@value='Continue >>']").click()
Sign up to request clarification or add additional context in comments.

6 Comments

i tried to add your script it still giving me the error
it worked for me without any wait. What error do you get
This is my entire code 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.find_element_by_name("//a[contains(.,'Trainer Battle')]").click() 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() driver.find_element_by_xpath("//input[@value='Continue >>']").click()
thank you so much it worked. what script i can add to click restart option there?
this is the xpath for Restart battle link: //a[contains(.,'Restart Battle')]
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.