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