Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

232
Views
Python Selenium get value of tooltip text with javascript website

I am new to Selenium. Read through many historical posts and try to retrieve tooltip text but fail...

X path (for "col_issued_shares" should be correct as it is directly copy like below screen:

Screenshot 1

The result is SyntaxError: invalid syntax. My expected output is Issued Shares 20,428,671,958 ( as at 27 May 2022) . But when I view source , it shows toolkit text.

Screenshot 2

Screenshot 3

from selenium import webdriver
from selenium.webdriver.chrome.service import Service
from selenium.webdriver.common.by import By
from selenium.webdriver import Chrome
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC


s=Service(r'C:\Users\chromedriver.exe')
driver = webdriver.Chrome(service=s)
url='https://www.hkex.com.hk/Market-Data/Securities-Prices/Equities/Equities-Quote?sym=5&sc_lang=en'
driver.get(url)

element = driver.find_element(By.XPATH, "//*[@id="lhkexw-quoteequities"]/div[2]/div[3]/div[2]/div/div[2]/div[1]/div[1]/span[2]/span")

Can someone help? Thanks a lot

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Try xpath //*[@id='lhkexw-quoteequities']/div[2]/div[3]/div[2]/div/div[2]/div[1]/div[1]/span[2]/span

Actually you are enclosing xpath with double quotes ("). So in xpath you should use single-quote (') for @id=''.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!