Can I use selenium or do I need a different module in order to click this kind of button? and what is the related code please?..... see details as follows and thanks for your help in advance.
I am a newbie to coding altogether. Slowly learning Python.
Current project is logging into trading website - my code is failing on last button click.
The HTML related to the button includes: v-on:click="submitForm" :disabled="isSubmit"
From a quick search this is Vue.js which I am not familiar with.
Ps my very first coding question!
ERROR MESSAGE:
line 21, in
login_button.click()
AttributeError: 'list' object has no attribute 'click'
WRITTEN CODE:
from selenium import webdriver
USERNAME = 'XXXXXX'<br>
PASSWORD = 'YYYYYY'
PATH = 'C:\Program Files (x86)\chromedriver.exe'
driver = webdriver.Chrome(PATH)
driver.get('https://www.nabtrade.com.au/investor/home')<br>
open_login_button = driver.find_element_by_id('btn-login')<br>
open_login_button.click()
user_input = driver.find_element_by_id('usernameField')<br>
user_input.send_keys(USERNAME)
password_input = driver.find_element_by_id('passwordField')<br>
password_input.send_keys(PASSWORD)
*login_button = driver.find_elements_by_class_name('btn btn-primary btn-block')*<br>
*login_button.click()*
NOTE: last two line of code are the ones failing
the above error is because you are using
find_elementsinstead offind_element.will return a list of web element in Selenium Python bindings.
where as
returns a single web element.
I see you are using class name with spaces, that is not supported by Selenium-Python, try switching to
xpath:Your code should look like this :