我正在使用
selenium 4.14.0
和 mozilla 119.0
和 GeckoDriver-v0.33.0
。
因此,我如何在 log in
上Instagram
?通过代码。
我不知道如何使用 automatically
并根据我使用的软件版本来 login
Instagram
到 Selenium
。
**Please find the below code, where I have scrapped the code to log in the Instagram.**
driver = webdriver.Firefox()
# Open the Instagram login page
driver.get("https://www.instagram.com/accounts/login/")
# Find the username and password fields by their name attribute
username = driver.find_element_by_name("username")
password = driver.find_element_by_name("password")
# Enter your username and password
username.send_keys("your_username")
password.send_keys("your_password")
# Press the enter key to submit the form
password.send_keys(Keys.RETURN)
# Wait for the page to load
driver.implicitly_wait(10)
# You are now logged in to Instagram
print("Login successful!")