1

I am a beginner in web scraping in selenium python. I am trying to scrape the data that shows the annual prices for the various drugs. However I am getting an error that says :

Traceback (most recent call last): File "other.py", line 11, in paths = WebDriverWait(d,10).until(EC.presence_of_all_elements_located((By.CSS_SELECTOR, ".highcharts-grid highcharts-yaxis-grid path"))) File "wait.py", line 80, in until raise TimeoutException(message, screen, stacktrace) selenium.common.exceptions.TimeoutException: Message:

I am unsure what I have to do. The code I have so far is :

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

url = 'http://abacus.realendpoints.com/ConsoleTemplate.aspx?act=qlrd&req=nav&mop=abacus!main&pk=ed5a81ad-9367-41c8-aa6b-18a08199ddcf&ab-eff=1000&ab-tox=0.1&ab-nov=1&ab-rare=1&ab-pop=1&ab-dev=1&ab-prog=1.0&ab-need=1&ab-time=1543102810'
d = webdriver.Chrome()
actions = ActionChains(d)
d.get(url)
paths = WebDriverWait(d,10).until(EC.presence_of_all_elements_located((By.CSS_SELECTOR, ".highcharts-grid highcharts-yaxis-grid path")))
results = []
for path in paths:
    actions.move_to_element(path).perform()
    actions.click_and_hold(path).perform()
    items = d.find_elements_by_css_selector('#priceChart path + text tspan')
    result = [item.text for item in items]
    if result:
        results.append(result)
d.close()
print(results)
Eric Oh
  • 43
  • 8
  • 1
    Please add the full Traceback error to your question. – amanb Jan 22 '19 at 07:54
  • What are the _Manual Steps_ which you are trying to _Automate_? – undetected Selenium Jan 22 '19 at 08:12
  • I am trying to extract the annual prices for each of the drugs at the top of the page. The price only appears when you hover over each of the separated rectangles – Eric Oh Jan 22 '19 at 08:15
  • Does [this](https://stackoverflow.com/questions/41829000/selenium-webdriver-java-how-to-click-on-elements-within-an-svg-using-xpath) or [this](https://stackoverflow.com/questions/54236662/unable-to-locate-svg-elements-through-xpath-on-kendo-ui-chart/54237441#54237441) discussion helps you? – undetected Selenium Jan 22 '19 at 08:23
  • No not really. I have no clue what my error is so – Eric Oh Jan 22 '19 at 09:00

1 Answers1

0

If i search id as "highcharts-grid highcharts-yaxis-grid" in resources its saying 2 results found and if i search id "highcharts-grid highcharts-yaxis-grid path" its says me 0 match found i have share the screen shot please look into it and let us know

First Image using "highcharts-grid highcharts-yaxis-grid" enter image description here

Second Image using "highcharts-grid highcharts-yaxis-grid path"

enter image description here

UPDATE

Please visit this link if you want to learn how to find and use xpath :

https://confengine.com/selenium-conf-2018/proposal/6018/chropath-a-smarter-way-to-get-locators-and-verify-them

akshay patil
  • 670
  • 7
  • 20