svg tag scraping from funnels

2024/11/17 13:20:47

I am trying to scrape data from here but getting error. I have taken code from here Scraping using Selenium and python

This code was working perfectly fine but now I am getting error

 wait.until(EC.visibility_of_element_located((By.LINK_TEXT, "All Boards")))  raise TimeoutException(message, screen, stacktrace)
Answer

After clicking on pe-funnel link , you can try with this code :

wait.until(EC.visibility_of_element_located((By.XPATH, "//*[name()='text' and @text-anchor='end']"))) all_data = driver.find_elements_by_xpath("//*[name()='text' and @text-anchor='end']")print(len(all_data))for data in all_data:print(data.text)  

UPDATE1 :

from selenium import webdriver
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
from selenium.webdriver.support.select import Select
import timedriver = webdriver.Chrome(executable_path = r'D:/Automation/chromedriver.exe')
driver.maximize_window()
driver.get("https://eu1.dashboard.clevertap.com/login.html")wait = WebDriverWait(driver, 20)
action = ActionChains(driver)driver.switch_to.default_content()wait.until(EC.element_to_be_clickable((By.NAME, "email"))).send_keys("abhishe***")wait.until(EC.element_to_be_clickable((By.NAME,"password"))).send_keys("***")  wait.until(EC.element_to_be_clickable((By.ID,"submitBtn"))).click()wait.until(EC.visibility_of_element_located((By.CSS_SELECTOR, 'div.ct-breadcrumb')))driver.switch_to.default_content()  
action.move_to_element(driver.find_element_by_css_selector("div.sidebar__brand+ul>li:first-child>a")).perform()wait.until(EC.visibility_of_element_located((By.LINK_TEXT, "All Boards")))  wait.until(EC.element_to_be_clickable((By.LINK_TEXT,"All Boards"))).click()wait.until(EC.element_to_be_clickable((By.LINK_TEXT,"pe-funnel"))).click()time.sleep(1)driver.execute_script("window.scrollTo(0,100)")wait.until(EC.presence_of_all_elements_located((By.XPATH,"//*[name()='svg' and @class='highcharts-root']")))all_charts = driver.find_elements_by_xpath("//*[name()='svg' and @class='highcharts-root']")
length_of_list = len(all_charts)
print(length_of_list)
i=0
while(i<len(all_charts)):wait.until(EC.presence_of_all_elements_located((By.XPATH,"//*[name()='svg' and @class='highcharts-root']")))all_charts = driver.find_elements_by_xpath("//*[name()='svg' and @class='highcharts-root']")all_charts[i].click()i=i+1try:print("Switch to frame")wait.until(EC.frame_to_be_available_and_switch_to_it((By.ID,"wiz-iframe-intent")))print("Switched to frame")wait.until(EC.element_to_be_clickable((By.XPATH, "//button[text()='OK' and @class='annoucement-popup__btn']"))).click()driver.switch_to.default_content()print("Clicked on Ok button")except:print("in catch block")passprint("last of CATCH BLOCK")driver.execute_script("window.scrollTo(0,1100)")ActionChains(driver).move_to_element(driver.find_element_by_css_selector("input[data-introp='View your analysis']")).click().perform()#wait.until(EC.element_to_be_clickable((By.CSS_SELECTOR,""))).click()#ActionChains(driver).move_to_element(driver.find_element_by_css_selector("label[for='funnelProgressionPercent']")).send_keys(Keys.END).perform()wait.until(EC.presence_of_all_elements_located((By.XPATH,"//*[name()='tspan' and @class='highcharts-text-outline']")))  all_values = driver.find_elements_by_xpath("//*[name()='tspan' and @class='highcharts-text-outline']")  for values in all_values:print(values.text)  driver.execute_script("window.history.go(-1)")driver.refresh()
https://en.xdnf.cn/q/118796.html

Related Q&A

Python search for multiple values and show with boundaries

I am trying to allow the user to do this:Lets say initially the text says:"hello world hello earth"when the user searches for "hello" it should display:|hello| world |hello| earthhe…

Python: create human-friendly string from a list of datetimes

Im actually looking for the opposite of this question: Converting string into datetimeI have a list of datetime objects and I want to create a human-friendly string from them, e.g., "Jan 27 and 3…

Python replace non digit character in a dataframe [duplicate]

This question already has answers here:Removing non numeric characters from a string in Python(9 answers)Closed 5 years ago.I have the following dataframe column>>> df2[Age]1 25 2 35 3 …

PyGame.error in ubuntu

I have problem with pygame and python 3 in ubuntu 12.10. When i tried load an image i got this error: pygame.error: File is not a Windows BMP fileBut in python 2.7 all works fine. I use code from http:…

Firebase Admin SDK with Flask throws error No module named firebase_admin

--- Question closedIt was my mistake, my uWSGI startup script switches to a different virtualenv.--- Original questionIm trying to publish push notifications from my Flask app server to Android APP. Se…

Recursive generator for change money - python

First, thanks for any help. I have this recursive code for counting ways of change from a list of coins and a given amount. I need to write a recursive generator code that presents the ways in every it…

Like button not recording the data [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.This question was caused by a typo or a problem that can no longer be reproduced. While similar q…

Python, Pygame, Image manipulation: Restretch a loaded png, to be the texture for an isometric Tile

Im a 17 year old programmer, trying to program an isometric game in python, with pygame. After finishing a tile engine, working with not good looking, gimp-drawn PNGs, I wondered, if it would be possib…

TypeError: list object is not callable [duplicate]

This question already has answers here:TypeError: list object is not callable while trying to access a list(9 answers)Closed 10 years ago.I cant find the problem im facing... this is exactly what the …

Tokenise text and create more rows for each row in dataframe

I want to do this with python and pandas.Lets suppose that I have the following:file_id text 1 I am the first document. I am a nice document. 2 I am the second document. I am an even …