2016-11-06 11 views
1

Python 3.6とSeleniumを使用してウェブサイト上の情報を収集しようとしていますが、ページはChrome(54.0.2840.87(64ビット))にすぐに読み込まれます。タブ(ケースログ)を半秒間クリックすると、別のタブ(アラート)に変わります。Python Selenium Elementはクリックできません

「find_element_by」を使用して見つけようとしましたが、特定の時点でタブをクリックして(ケースログ)、テキストを検索しました。私が 'find_element_by_xpath'を使うと、 '要素はポイント(488,93)でクリックできません。他の要素はクリック 'を受け取ります。ここで

はコードです:

from selenium import webdriver 
from time import sleep 
from selenium.webdriver.common.keys import Keys 
from selenium.webdriver.common.by import By 
from selenium.webdriver.support.ui import WebDriverWait 
from selenium.webdriver.support import expected_conditions as EC 
from selenium.webdriver.common.action_chains import ActionChains 


#enter credentials 
user = input('User: ') 
password = input('Password: ') 
case = input('Case: ') 

#open the page 
driver= webdriver.Chrome() 
driver.maximize_window() 
driver.get('.com') 

#login 
elem = driver.find_element_by_id("user") 
elem.send_keys(user) 
elem = driver.find_element_by_id("password") 
elem.send_keys(password) 
elem.send_keys(Keys.RETURN) 

#Find Case 
elem = driver.find_element_by_id("searchCaseIdHome") 
elem.send_keys(case) 
elem.send_keys(Keys.RETURN) 

#Find Notes 
elem = driver.find_element_by_xpath("//*[@id='ext-gen151']") 
elem.click() 

https://i.stack.imgur.com/wIG7V.png

https://i.stack.imgur.com/aUmTN.png

+0

URLを共有することはできますか?どの要素をクリックしますか?あなたがそのページで何をしたいのかを教えてください。 – testerjoe2

+0

残念ながら、私は職場で使っているツールなので、URLを共有できないのですが、ケースログでクリックするにはウェブドライバが必要です(クリックするにはctrl + fを押してテキストを探してください)画像添付)。 –

+0

エラーの原因はnonunqiue xpath ....です。ページのいくつかの特別なHTMLを追加してください。 – thebadguy

答えて

-1
elem = driver.find_element_by_xpath("//*[@id='ext-gen151']") 
elem.location_once_scrolled_into_view 
elem.click() 
+0

selenium.common.exceptions.WebDriverException:メッセージ:不明なエラー:要素がポイント(864,94)でクリック可能ではありません。他の要素はクリックを受け取ります:

+0

このスクリーンショットは役に立ちます:https://i.stack.imgur.com/aUmTN.png –

関連する問題