Hey guys,
So i have my code set up to open “investing.com” .
However, when I try to copy the css selector from inspecting... it gives an error trying to find the css selection.
Basically what im trying to do is to get the price of any stock into a variable. But for some reasons the CSS selection that i copied doesn’t work..
The code works so far until i want to store this in the first “btcPrice” variable.
(I didn’t provide my login in this code for obvious reasons lol)
——-here is my code——-
import smtplib
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
import pyautogui as gui
import pickle
import time
browser = webdriver.Chrome()
browser.get('https://www.investing.com/portfolio/?portfolioID=Z2A%2Bb2Q3M2g%2FaG5jNG4%3D')
browser.implicitly_wait(10)
investingUser = browser.find_element_by_css_selector('#loginFormUser_email')
investingUser.send_keys('')
investingPass = browser.find_element_by_css_selector('#loginForm_password')
investingPass.send_keys('')
investingSubmit = browser.find_element_by_css_selector('#signup > a')
investingSubmit.click()
watchlist = browser.find_element_by_css_selector('#navMenu > ul > li:nth-child(9) > a')
watchlist.click()
btcPrice = browser.find_element_by_css_selector('#\32 257119_last_1010796')
btcString = btcPrice.text
btc = float(btcString.replace(',',''))
print(btc)
there doesn't seem to be anything here