I am trying to write a code using Python with selenium that will login to Applemusic.
- Should open this URL: https://music.apple.com/login
After which the sign in Frame would pop up, I want to be able to input the AppleID (say example@gmail.com) with password say (Apple2020)
I want to be able to open a particular song url or playlist link so that I can manually play the songs.
My code so far:
from time import sleep
import Password
from selenium import webdriver
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as EC
class Applemusic:
def __init__(self, username):
driver = webdriver.Chrome()
driver.get("https://music.apple.com/login")
sleep(20)
for a in username:
WebDriverWait(driver, 10).until(EC.frame_to_be_available_and_switch_to_it((By.ID, "aid-auth-widget-iFrame")))
WebDriverWait(driver, 10).until(EC.element_to_be_clickable((By.ID, "account_name_text_field"))).send_keys(a)
sleep (10)
password = "Apple2020"
for i in password:
WebDriverWait(driver, 10).until(EC.element_to_be_clickable((By.ID, "password_text_field"))).send_keys(i)
Applemusic('example@gmail.com')
This is the error:
Traceback (most recent call last): File "/Users/mike/Documents/Python/Applemusic.py", line 21, in Applemusic('example@gmail.com') File "/Users/mike/Documents/Python/Applemusic.py", line 14, in init WebDriverWait(driver, 10).until(EC.frame_to_be_available_and_switch_to_it((By.ID, "aid-auth-widget-iFrame"))) File "/Users/mike/Documents/Python/venv/lib/python3.8/site-packages/selenium/webdriver/support/wait.py", line 80, in until raise TimeoutException(message, screen, stacktrace) selenium.common.exceptions.TimeoutException: Message:
I don't know what I'm not doing right. My python knowledge is just average, I would appreciate if anyone can help me achieve my goal.
