Error using find_element_by_tag_name - Selenium python

Asked

Viewed 12 times

0

I am trying to access the following element on a web page: [! [insert image description here][1]][1]

The code I’m writing is this:

import os
import time
import bs4
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.support.ui import Select
from selenium.webdriver.common.keys import Keys

def acessaWeb(ip):

    url = 'http://' + ip

    driver = webdriver.Chrome('C:\ArqImpSEFAZ\webDriver\chromedriver.exe')

    driver.get(url)
    time.sleep(5)

    user = driver.find_element_by_tag_name("arg01_UserName")
    user.clear()
    user.send_keys("Admin")

    driver.quit()

I get the following error:

Devtools Listening on Ws:/127.0.0.1:58647/devtools/browser/73bfdf5e-497d-4c6d-9301-cbd5f3192802 [852:1596:0903/145547.892:ERROR:device_event_log_impl.cc(214)] [14:55:47.895] Bluetooth: bluetooth_adapter_winrt.cc:1073

Getting Default Adapter failed. Traceback (Most recent call last): File "c: Arqimpsefaz automato2.py", line 54, in main() File "c: Arqimpsefaz automato2.py", line 51, in main acessaWeb(ip) File "c: Arqimpsefaz automato2.py", line 37, in acessaWeb user = driver.find_element_by_tag_name("arg01_UserName") File "C: Users Hudson.Martins Appdata Local Programs Python Python39 lib site-Packages Selenium webdriver remote webdriver.py", line 530, in find_element_by_tag_name Return self.find_element(by=By.TAG_NAME, value=name) File "C: Users Hudson.Martins Appdata Local Programs Python Python39 lib site-Packages Selenium webdriver remote webdriver.py", line 976, in find_element Return self.execute(Command.FIND_ELEMENT, { File "C: Users Hudson.Martins Appdata Local Programs Python Python39 lib site-Packages Selenium webdriver remote webdriver.py", line 321, in execute self.error_handler.check_response(Answer) File "C: Users Hudson.Martins Appdata Local Programs Python Python39 lib site-Packages Selenium webdriver remote errorhandler.py", line 242, in check_response raise exception_class(message, screen, stacktrace) Selenium.common.exceptions.Nosuchelementexception: Message: no such element: Unable to locate element: {"method":"css selector","selector":"arg01_UserName"}

Please, does anyone have any idea how to fix it? [1]: https://i.stack.Imgur.com/usZrN.png

  • Please clarify your problem or provide additional details in order to highlight exactly what you need. The way it’s written these days it’s hard to tell exactly what you’re asking.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.