python - Cannot click button - element not found -
i have tried make script click log in button on spotify login page. have been searching day solution, no matter class, css or whatever put in, saying not find object.
my code:
import selenium selenium import webdriver browser = webdriver.firefox() browser.get("https://accounts.spotify.com/en/login? continue=https:%2f%2fwww.spotify.com%2fdk%2faccount%2foverview%2f") username = browser.find_element_by_id("login-username") password = browser.find_element_by_id("login-password") username.send_keys("myuser") password.send_keys("mypass") login = browser.find_element_by_class_name('ng-pristine ng-valid-sp- disallow-chars ng-invalid ng-invalid-required').click() it last line have problem with. note: 1 of options tried.
you can try code have xpath:
login = browser.find_element_by_xpath("//button[contains(.,'log in')]"); login.click();
Comments
Post a Comment