0

I am having issues getting an element from the netlify dashboard. The code I have currently selected the element and shows the base element the web developers set, so obviously, they update it with javascript however how do I get this. On my dashboard it states 1 MB but my output is 0 KB each time so it seems I am only getting the base text My code:

driver = webdriver.Chrome()
driver.get("https://app.netlify.com/teams/jimbob0119/overview")
element = driver.find_element_by_name("github")
element.click()
driver.implicitly_wait(10) # seconds
login = driver.find_element_by_name("login")
login.send_keys(email)
password = driver.find_element_by_name("password")
password.send_keys(passwordstr)
loginbtn = driver.find_element_by_name("commit")
loginbtn.click()
driver.implicitly_wait(10) # seconds
getbandwidth = driver.find_element_by_xpath("//dd[@class='tw-text-xl tw-mt-4px tw-leading-none']")
print(getbandwidth.text)

The HTML:

<dd class="tw-text-xl tw-mt-4px tw-leading-none"> 1 MB 
    <span class="tw-text-gray-darker dark:tw-text-gray-light tw-text-base">
        <span class="tw-sr-only">
            out of
        </span> /100 GB 
    </span>
    <span class="tw-absolute tw-mt-2px tw-w-full">
    </span>
</dd>

my output:

0 KB
out of
/100 GB
14
  • Please read why a screenshot of code is a bad idea. Paste the code and properly format it instead. Code includes HTML. Commented Apr 17, 2021 at 14:34
  • $3 is specific to the Chrome devtools and is not in the HTML so it cannot be fetched. If you tell us which value you're trying to get, we can help with that. Commented Apr 17, 2021 at 14:36
  • okay will do sorry Commented Apr 17, 2021 at 14:37
  • Also, implicitly_wait() doesn't actually wait. What it does do is set a timeout for that instance of the driver. So, you only need to call it once, unless you plan to change the wait value from say 10s to 30s or whatever. The rest of the calls can be removed. Commented Apr 17, 2021 at 14:38
  • I am trying to get the bandwidth my websites are using on netlify.com, it's updated to 1 MB however I only get 0 KB which is obviously it's base, or original state Commented Apr 17, 2021 at 14:55

1 Answer 1

0

JeffC figutrd it out by stating to put a time.sleep(5) before printing it thank you!

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.