Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

150
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda