Issue
I tried to export the generated chart to png file from the menu in this website. After I manage to enter a city name and Visualize Results with script, the website shows some information and chart where I can export to png, either with small or large option. However, I could not manage to export large png file (option that I selected) of the chart because the script reach the timeout exception. The following is line that I've tried:
elem = wait(driver, 10).until(EC.presence_of_element_located((By.ID, 'tr_exportpngl')))
elem.click()
i tried also solutions from other questions such as wait until 'lement_to_be_clickable' or finding by XPATH, still no success.
elem = wait(driver, 10).until(EC.element_to_be_clickable((By.XPATH, '//div[@id="tr_exportpngl"]')))
elem.click()
How can i make this work?
i look forward for your suggestion. thank you in advance.
Solution
First, before clicking this button you need to click the export button which opens the dropdown with the options. This code did the thing:
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from time import sleep
driver = webdriver.Chrome()
driver.maximize_window()
driver.implicitly_wait(10)
driver.get('https://re.jrc.ec.europa.eu/pvg_tools/en/')
driver.find_element(By.ID, 'map').click()
sleep(2)
driver.find_element(By.ID, 'tr_visualize').click()
sleep(2)
driver.find_element(By.XPATH, '//*[@class="highcharts-button"]').click()
WebDriverWait(driver, 10).until(EC.presence_of_element_located((By.ID, 'tr_exportpngl'))).click()
Answered By - Eugeny Okulik
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.