Quantcast
Channel: Active questions tagged selenium - Stack Overflow
Viewing all articles
Browse latest Browse all 98423

Selenium Python - Clicking button by XPATH error

$
0
0

I am trying to click the login button on a site, however I proceed to get an error.

I have tried getting the element by xpath, id, text and other ways but none worked for me.

from selenium import webdriver
from selenium.webdriver.common.keys import Keys
import time
import random

while True:
    time.sleep(4)
    browser = webdriver.Chrome("C:\webdrivers/chromedriver.exe")
    #browser = webdriver.Chrome()
    browser.get("https://www.brickplanet.com/login")

    username = browser.find_elements_by_xpath('//*[@id="username"]')
    #username.clear()
    #username.send_keys('KOMKO190')

    password = browser.find_elements_by_xpath('//*[@id="password"]')
    #password.clear()
    #password.send_keys('this is my password btw!')

    login = browser.find_elements_by_id("submit")
    login.click()

Traceback (most recent call last): File "C:\Users\DOMA\Desktop\bp hack.py", line 23, in login.click() AttributeError: 'list' object has no attribute 'click'

Process returned 1 (0x1) execution time : 13.061 s Press any key to continue . . .


Viewing all articles
Browse latest Browse all 98423

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>