You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

使用Selenium操作Chrome登录Instagram时窗口立即关闭的问题求助

使用Selenium操作Chrome登录Instagram时窗口立即关闭的问题求助

各位好,我现在碰到个棘手的问题:想用Selenium操控Chrome打开Instagram页面并尝试登录,但浏览器窗口刚弹出来就直接关闭了,完全没法继续下一步操作。我把当前写的代码贴在下面,有没有朋友能帮我排查下问题所在呀?

我的代码如下:

url = "https://www.instagram.com"
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.chrome.service import Service
import time
from bs4 import BeautifulSoup

driver = webdriver.Chrome()
driver.get(url)
driver.maximize_window
click_button = driver.find_element(value="a9-- _ap36 _a9_0")
click_button.click
time.sleep(2000)

备注:内容来源于stack exchange,提问作者Mehmet Can Şahin

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.04.14 17:58:12