Python | Selenium | Looking for html element

Asked

Viewed 74 times

-2

Hello guys I am beginner in python and little knowledge in html, I’m trying to do makes a search for information on a dvr Intelbras via web page.

  • until a certain point I manage to do what was expected, but I am not moving forward in the search for an element. follows the path of the _Storage element:

Esse é o caminho completo do elemento _storage que eu quero buscar

Being able to follow from HTML to frame_set (Marked in green), after which you cannot go to the next html inserir a descrição da imagem aqui

inserir a descrição da imagem aqui

I’ve tried many ways and I can’t find anything on the Internet or in documentation

follows python code:

from selenium import webdriver
from webdriver_manager.microsoft import IEDriverManager
from time import sleep


driver = webdriver.Ie(IEDriverManager().install())
driver.get('http://192.168.15.2/')
if driver.find_element_by_class_name('login-inputbox').is_displayed():
driver.find_element_by_id('username').send_keys("py")
driver.find_element_by_id('password').send_keys("py")
driver.find_element_by_class_name('login_confirm').click()
sleep(15)
driver.find_element_by_id('xxtpz').click()
sleep(3)
element_one = driver.find_element_by_id('m')
sleep(3)
element_two = element_one.find_element_by_id('f_setup')
sleep(3)
element_tree = element_one.find_element_by_id('frame_set')

Could someone please give me a hand?

  • Does it need to be done with Selenium? I ask because I believe Selenium is an exaggerated tool for simple data scraping.

1 answer

0

From what I understand, you are trying to search for an element that is not located within the main page frame. By default the main frame or one that is available when you open a page is named default_content. If any element is inside another frame you will not locate it without "entering" this frame. If you are inside a frame and the element is in default_content you will not be able to locate it without going back to the main frame. Try switching to this frame before, with

>> driver.switch_to_frame(frame)

After this, search for the element you want again!

Browser other questions tagged

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