前提・実現したいこと
withのトップ(https://with.is/search)に出てくる画像全てをクリックして戻るを繰り返す足跡ツールを作りたいのですができません。seleniumを使ったことがあまりないのでどうすれば良いか分かりません。教えて頂きたいです。
トップまで表示させることはできるので、後半のaタグの指定に問題があると思います。element not visibleがどのようなエラーなのか合わせて教えて頂けると幸いです。
発生している問題・エラーメッセージ
selenium.common.exceptions.ElementNotVisibleException: Message: element not visible (Session info: chrome=64.0.3282.167) (Driver info: chromedriver=2.35.528161 (5b82f2d2aae0ca24b877009200ced9065a772e73),platform=Windows NT 10.0.16299 x86_64)
該当のソースコード
python3
1import os 2import time 3import random 4import sys 5from selenium import webdriver 6from selenium.webdriver.common.keys import Keys 7from selenium.webdriver.support.ui import WebDriverWait 8from selenium.webdriver.support import expected_conditions 9from selenium.webdriver.common.by import By 10username="********" 11password="*******" 12i=1 13#自動ログイン開始 14chro = webdriver.Chrome(path) 15chro.get("https://with.is/#_=_") 16time.sleep(1) 17chro.find_element_by_class_name('login-header_submit').click()#facebookでログインのボタンを押す 18userNameField = chro.find_element_by_xpath("//*[@id='email']") 19userNameField.send_keys(username) 20passwordField = chro.find_element_by_xpath("//*[@id='pass']") 21passwordField.send_keys(password) 22submitButton = chro.find_element_by_xpath("//*[@id='loginbutton']") 23submitButton.click() 24time.sleep(2) 25while i < 1000: 26 elements = chro.find_elements_by_tag_name('a') 27 elements[i].click() 28 time.sleep(random.randint(5,10)) 29 chro.back() 30 i=i+1 31else: 32 print("1000人に足跡を付けました") 33 chro.close() 34 35
試したこと
ここに問題に対して試したことを記載してください。
補足情報(FW/ツールのバージョンなど)
ここにより詳細な情報を記載してください。
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。