I am trying to retrieve a list of values from the xpath locator RPA selenium the program returns an empty, I can’t figure it out

  Kiến thức lập trình

from RPA.Browser.Selenium import Selenium
from selenium.webdriver.common.by import By

browser = Selenium()

class RPA_Challenge():

def find_search(self):
     # Navigate to url
    browser.open_available_browser("https://news.yahoo.com/")
    #attribute selection(choose element on the html or xml based on their attribute value)
    getElement = browser.find_elements(locator="xpath://input[@name='text']//parent::form")

    # error the returns empty list

    for data in getElement:
        result = data.find_elements(By.CLASS_NAME, 'text')
        for input_data in result:
            print(input_data.text)
            time.sleep(4)

I tried to iterate over the getElement variable thats points to the xpath to retrieve the elements of the search

New contributor

user14936648 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

LEAVE A COMMENT