1

Hi I am trying to login to https://rocket-league.com/ using Selenium. I have managed to login successfully using POST request method in BeautifulSoup but now I have to use Selenium because after logging into the website I have to click on a button, which I cannot do using BeautifulSoup.

There is a button in the form that says 'GO' which logins to website once the email and password are correct. I have tried the submit() method but got the following error : javascript error: arguments[0].submit is not a function (Session info: chrome=87.0.4280.88)

from selenium import webdriver
driver_path = r"C:\Users\user\Downloads\chromedriver.exe"
driver = webdriver.Chrome(executable_path=driver_path)

homepage_URL = 'https://rocket-league.com'

driver.get(homepage_URL)
driver.find_element_by_id('acceptPrivacyPolicy').click()
driver.find_element_by_id('header-email').send_keys('email')
driver.find_element_by_id('header-password').send_keys('password') 
btn = driver.find_element_by_xpath('/html/body/header/section[1]/div/div[2]/div[1]/form/input[4]')
btn.submit()

Then I tried the click() method but I got a different error: ElementClickInterceptedException: element click intercepted: Element is not clickable at point (1077, 17) (Session info: chrome=87.0.4280.88)

I have successfully logged into the website using BS post method by posting required values to the php form.

data = {'email':'email','password':'password','csrf_token':token,'rememberme':'on','submit':'Go'}
url = 'https://rocket-league.com/functions/login.php'
result = s.post(url,data=data,cookies= cookie)

What should I do?

2 Answers 2

1

Indeed you were very close in the attempt with selenium. Try this some changes and it will start working -

Maximize the window - sometimes websites are not responsive and by default chrome opens in small window. When selenium locates Go button element it is not in the view and hence the error

Use proper locators or relative xpath. Absolute xpath makes the scripts flaky.

homepage_URL = 'https://rocket-league.com'

driver.get(homepage_URL)
driver.maximize_window()
driver.find_element_by_id('acceptPrivacyPolicy').click()
driver.find_element_by_id('header-email').send_keys('email')
driver.find_element_by_id('header-password').send_keys('password') 
btn = driver.find_element_by_xpath('.//input[@value="Go"]')
btn.click()

Output -

enter image description here

Sign up to request clarification or add additional context in comments.

Comments

0

submit function works only with html form , as login form is a submit in the page it should work.

But when you try the submit action we get the following error:

enter image description here

This because the form field ahs one field with name submit , the button element name is given as "submit"

This is why only click() works .

But for other pages, you can use submit() on any form fields

"Submit is not a function" error in JavaScript

4 Comments

I checked that post before and tried the same approach on my code but I wasn't able to solve my problem. Thanks for the heads up!
yes it is not working because name of the button is submit
there should not be any field with that name
Yes I am aware of that now thanks to your explanation :)

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.