Home > other >  How to login to bet365 using selenium python
How to login to bet365 using selenium python

Time:10-25

I am trying to login to my account on bet365.com using selenium python. I know that the sites detects selenium and most people usually run into issues. but i didnt get any of the common issues. The sites loads well but when I try to input my correct login details. It says Login details not recognized.

This is my code:

        self.driver.get('https://www.bet365.com')
        
        # Waits until page is fully loaded
        WebDriverWait(self.driver, 20).until(lambda x: 'Log In' in self.driver.page_source)

        login_frame = self.wait(By.CLASS_NAME, 'hm-MainHeaderRHSLoggedOutWide_Login ', time=70)
       
        # Function that clicks the login button
        self.doAction(login_frame)
       
        # Function that waits until the login popup shows
        username = self.wait(By.CLASS_NAME, 'lms-StandardLogin_Username ', time=5)
        username.clear()
        username.send_keys('username') # my username

        password = self.driver.find_element_by_class_name('lms-StandardLogin_Password ')
        password.clear() 
        password.send_keys('password') # my password

        password.send_keys(Keys.RETURN)

is the issue from the site or is the site just saying that because i am using selenium. If i login normally it works fine. Please any swift help will be appreciated

CodePudding user response:

Try to use enter key instead of pass return from password textbox. Same happened to me. Perhaps it would work

from selenium.webdriver.common.keys import Keys
self.driver.find_element_by_class_name("class_name").sendKeys(Keys.ENTER);

CodePudding user response:

It is almost certainly the website prohibiting your code.

bet.365 is a very popular website that definitely incorporates anti-webscraping and bot detection.

Not to mention is also against their terms of service:

https://help.bet365.com/en/terms-and-conditions

If you are still adament you can check out the thread below for work arounds:

Can a website detect when you are using Selenium with chromedriver?

  • Related