私はカートアイテムを掻き集め、ショッピングウェブサイトのそれぞれの価格を取得しようとしています
これまでのところ、これは私のコードですが、エラーが発生しています。私はのために、それぞれのユーザ名とパスワード([email protected]、パリ@日没)を使用すること自由に感じなさい、私は
from selenium import webdriver
chrome_path =r"C:\Users\aq4'july\Desktop\chromedriver.exe"
driver = webdriver.Chrome()
driver.get("https://www.myntra.com/")
#User Login
driver.find_element_by_xpath("""//*[@id="desktop-header-cnt"]/div[2]/div[2]/div/div[2]/div[2]/div[2]/a[2]""")
適切なXPathを取得していないです、私は取得していますエラーが
Traceback (most recent call last):
File "<pyshell#16>", line 1, in <module>
driver.find_element_by_xpath("""//*[@id="desktop-header-cnt"]/div[2]/div[2]/div/div[2]/div[2]/div[2]/a[2]""").click()
File "C:\Users\aq4'july\AppData\Roaming\Python\Python36\site-packages\selenium\webdriver\remote\webelement.py", line 80, in click
self._execute(Command.CLICK_ELEMENT)
File "C:\Users\aq4'july\AppData\Roaming\Python\Python36\site-packages\selenium\webdriver\remote\webelement.py", line 501, in _execute
return self._parent.execute(command, params)
File "C:\Users\aq4'july\AppData\Roaming\Python\Python36\site-packages\selenium\webdriver\remote\webdriver.py", line 311, in execute
self.error_handler.check_response(response)
File "C:\Users\aq4'july\AppData\Roaming\Python\Python36\site-packages\selenium\webdriver\remote\errorhandler.py", line 237, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.ElementNotVisibleException: Message: element not visible
(Session info: chrome=63.0.3239.84)
(Driver info: chromedriver=2.31.488763 (092de99f48a300323ecf8c2a4e2e7cab51de5ba8),platform=Windows NT 10.0.15063 x86_64)
だと思いますテスト目的。
注:私はPython 3.6を使用していますが、私は質問をしている間に何か逃したことを強調してください。
この式はよく見え、要素と一致する必要があります。あなたはどんなエラーを出していますか?あなたは[Explicit Wait](http://selenium-python.readthedocs.io/waits.html#explicit-waits)で待ってみましたか? – alecxe
番号。このコードをさらに拡張してみてください。カートのアイテムをリストする方法がわかりません –
は常に問題のフルエラーメッセージ(トレースバック)を貼り付けます(テキストとして、スクリーンショットではありません)。その他の有用な情報があります。 – furas