Arkadaşlar kodum bu:
from instagramUserInfo import username, password
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
import time
class Instagram:
def __init__(self, username, password):
self.browser = webdriver.Chrome()
self.username = username
self.password = password
def signIn(self):
self.browser.get('https://www.instagram.com/accounts/login/')
time.sleep(2)
usernameInput = self.browser.find_element(By.XPATH, "//*[@id='loginForm']/div/div[1]/div/label/input")
passwordInput = self.browser.find_element(By.XPATH, "//*[@id='loginForm']/div/div[2]/div/label/input")
usernameInput.send_keys(self.username)
passwordInput.send_keys(self.password)
passwordInput.send_keys(Keys.ENTER)
time.sleep(3)
def getFollowers(self):
self.browser.get(f"https://www.instagram.com/{self.username}")
time.sleep(3)
followersLink = self.browser.find_element(By.XPATH, "//*[@id='mount_0_0_fu']/div/div/div/div[1]/div/div/div/div[1]/div[1]/div[2]/section/main/div/ul/li[2]/a/div")
followersLink.click()
instgrm = Instagram(username, password)
instgrm.signIn()
instgrm.getFollowers()
selenium ile İnstagrama giriş yapmak istiyorum ama aşağıda ki hatayı alıyorum.
ERROR:DevTools listening on ws://127.0.0.1:52672/devtools/browser/48d6ad97-afc1-4f78-80e5-e400a6727cb8
[17604:25192:0111/144354.050:ERROR:device_event_log_impl.cc(215)] [14:43:54.050] Bluetooth: bluetooth_adapter_winrt.cc:1074 Getting Default Adapter failed.
Traceback (most recent call last):
File “C:\Users\oguzc\Desktop\Çalışmalarım\Yazılım\90-instagram.py”, line 33, in
instgrm.getFollowers()
File “C:\Users\oguzc\Desktop\Çalışmalarım\Yazılım\90-instagram.py”, line 27, in getFollowers
followersLink = self.browser.find_element(By.XPATH, “//[@id=‘mount_0_0_vv’]/div/div/div/div[1]/div/div/div/div[1]/div[1]/div[2]/section/main/div/ul/li[2]/a")
File “C:\Users\oguzc\AppData\Local\Programs\Python\Python310\lib\site-packages\selenium\webdriver\remote\webdriver.py”, line 861, in find_element
return self.execute(Command.FIND_ELEMENT, {“using”: by, “value”: value})[“value”]
File “C:\Users\oguzc\AppData\Local\Programs\Python\Python310\lib\site-packages\selenium\webdriver\remote\webdriver.py”, line 444, in execute
self.error_handler.check_response(response)
File “C:\Users\oguzc\AppData\Local\Programs\Python\Python310\lib\site-packages\selenium\webdriver\remote\errorhandler.py”, line 249, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {“method”:“xpath”,“selector”:"//[@id=‘mount_0_0_vv’]/div/div/div/div[1]/div/div/div/div[1]/div[1]/div[2]/section/main/div/ul/li[2]/a”}
(Session info: chrome=108.0.5359.125)
Stacktrace:
Backtrace:
(No symbol) [0x0035F243]
(No symbol) [0x002E7FD1]
(No symbol) [0x001DD04D]
(No symbol) [0x0020C0B0]
(No symbol) [0x0020C22B]
(No symbol) [0x0023E612]
(No symbol) [0x002285D4]
(No symbol) [0x0023C9EB]
(No symbol) [0x00228386]
(No symbol) [0x0020163C]
(No symbol) [0x0020269D]
GetHandleVerifier [0x005F9A22+2655074]
GetHandleVerifier [0x005ECA24+2601828]
GetHandleVerifier [0x00408C0A+619850]
GetHandleVerifier [0x00407830+614768]
(No symbol) [0x002F05FC]
(No symbol) [0x002F5968]
(No symbol) [0x002F5A55]
(No symbol) [0x0030051B]
BaseThreadInitThunk [0x768C7D69+25]
RtlInitializeExceptionChain [0x7794BB9B+107]
RtlClearBits [0x7794BB1F+191]
Bu problemi nasıl çözeceğim konusunda yardımcı olursanız çok sevinirim.