Home > Enterprise >  Accessing dollar sign $0 element in Python Selenium
Accessing dollar sign $0 element in Python Selenium

Time:06-25

I have an element with no name or id attribute I can only access with a dollar sign:

console.log($0);
"100"

How can I access this from Python Selenium? I'm trying this:

my_value=driver.find_element(By.NAME,"$0")

But I get this error:

selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"tag name","selector":"$0"}

CodePudding user response:

Find the element in your console, right-click it and select "Copy full XPath"

then you can use it like

driver.findElement(By.xpath("YOUR_XPATH_HERE"))

enter image description here

  • Related