をチェックし、私はこのコードクリックユーチューブボタンセレンPythonは私のコード
from selenium import webdriver
from selenium.common.exceptions import TimeoutException
from selenium.webdriver.support.ui import WebDriverWait # available since 2.4.0
from selenium.webdriver.support import expected_conditions as EC# available since 2.26.0
from selenium.webdriver.common.keys import Keys
driver = webdriver.Firefox()
driver.get("https://likesrock.com")
element = driver.find_element_by_class_name("ytp-large-play-button ytp-button")
element.click()
を使用してこのページhttps://likesrock.comでユーチューブvadio
をクリックしてクラスを使用してクリックしようとしていますが、compilorは私にこのerorr
を与えますトレースバック(最新のコール最後): ファイル "C:¥Users¥youssef¥Desktop¥python project¥xpath.py"、行25、 element = driver.find_ele ( "ytp-large-play-button ytp-button") ファイル "C:\ Python27 \ lib \ site-packages \ selenium \ webdriver \ remote \ webdriver.py"、413行目、find_element_by_class_name return self.find_element (by = CL._NAME、value = name) find_elementのファイル "C:¥Python27¥lib¥site-packages¥selenium¥webdriver¥remote¥webdriver.py"、752行目、 'value':value})[ 'value'] ファイル "C:¥Python27¥lib¥site-packages¥selenium¥webdriver¥remote¥webdriver.py"、行236、実行中 self.error_handler.check_response(応答) ファイル "C:\ Python27 (メッセージ、画面、スタックトレース) NoSuchElementException:メッセージ:ロケールできません(エラーメッセージは表示されません)。 TE素子:.ytp-大プレイボタンYTP-ボタン
あなたは動作しませんfind_element_by_class_name
中の化合物クラスを使用している
参照[こちら] (http://stackoverflow.com/q/10658907/7023590)。 – MarianD