Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

151
Vistas
Trying to get value determined by javascript using selenium

As title says, I am currently trying to acquire a dynamic value. I am lost as originally I was using beautiful soup and found out the value was dynamic. Here are how the values are determined

        .call({from: from})
        .then(function(res) {
            console.log("Node Price (Wei AVAX): " + res);
            const avax = Number(Web3.utils.fromWei(res, 'ether'));
            console.log("Node Price (AVAX): " + avax);
            const items = document.querySelectorAll(".node-info-price-avax");
            items.forEach(i => {
                i.innerHTML = avax.toFixed(2) + " AVAX";
            });
        })

Then here is how its displayed,

<span class="node-info-price-avax">27.88 AVAX</span>

I've been watching tutorials and reading over guides all day and can not for the love of me figure out how to acquire said value.

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

I found a pretty detailed video that did exactly what I was looking for. The solution was finding the data I needed and copying the xpath by using find_element, then I appened it to a list and used pandas to make it look pretty. Here is the finished code:

from selenium import webdriver
import pandas as pd

PATH = "C:\Program Files (x86)\chromedriver.exe"
driver = webdriver.Chrome(PATH)

driver.get("https://playa3ull.games")

node_data = driver.find_elements_by_class_name('wpb_wrapper')

data_list = []

for data in node_data:
    node_price = data.find_element_by_xpath('//*[@id="pb-node-info-table"]/tbody/tr[6]/td[2]/span[1]').text
    nodes_sold = data.find_element_by_xpath('//*[@id="pb-node-info-table"]/tbody/tr[3]/td[2]').text
    token_price = data.find_element_by_xpath('//*[@id="pb-node-info-table"]/tbody/tr[6]/td[2]/span[2]').text
    data_item = {
        'Node Price': node_price,
        'Nodes Sold': nodes_sold,
        'Token Price': token_price
    }
    data_list.append(data_item)

df = pd.DataFrame(data_list)
df_last = df[-1]
print(df_last)

Here is the link for a more detailed explanation: youtube.com/watch?v=lTypMlVBFM4

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda