I'm trying to find an element using Selenium and I'm not getting it. Follow the HTML code:
<div aria-disabled="false"
data-tb-test-id="DownloadCrosstab-Button"
role="button"
tabindex="0"
style="font-size: 12px; font-weight: normal; color: rgba(0, 0, 0, 0.7); display: inline-block; padding: 0px 24px; position: relative; text-align: center; border-style: solid; border-width: 1px; border-radius: 1px; height: 24px; line-height: 22px; min-width: 90px; box-sizing: border-box; outline: none; white-space: nowrap; user-select: none; cursor: default; background-color: rgba(0, 0, 0, 0); border-color: rgb(203, 203, 203); margin-top: 8px; width: 100%; -webkit-tap-highlight-color: transparent;"
>Tabela de referência cruzada</div>
I've tried the following codes:
x = browser.find_element_by_id("Downloadcrosstab")
x = browser.find_element_by_link_text("Downloadcrosstab-Button")
x = browser.find_element_by_class_name('Crosstab')
But I got the same error:
NoSuchElementException: no such element: Unable to locate element: {"method":"css selector","selector":".Crosstab"}
(Session info: chrome=75.0.3770.142)
data-tb-test-idis not the sameidso you can't get it by idid(much less one with a value ofDownloadcrosstab), there is noclass="Crosstab", so I don't know whyby_class_namewould be expected to work. Similarly, there's no link here at all, so searching by link text doesn't make sense either.