如何使用Selenium 4.14.0登录Instagram?

问题描述 投票:0回答:1

我正在使用

selenium 4.14.0
mozilla 119.0
GeckoDriver-v0.33.0
。 因此,我如何在
log in
Instagram
?通过代码。 我不知道如何使用
automatically
并根据我使用的软件版本来
login
Instagram
Selenium

python selenium-webdriver logging selenium-firefoxdriver
1个回答
0
投票
**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!")
© www.soinside.com 2019 - 2024. All rights reserved.