I'm trying to get my program (written in python
) to open multiple links at the same time. I can open one link – but when I change my command from find_element_by_link_text
to find_elements_by_link_text
it doesn't work.
For context, I'm trying to open all links on the page with the name 'Annual Report'
.
Here's the code I've tried:
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
import time
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
import options
driver = webdriver.Chrome()
driver.get('https://webb-site.com/')
search = driver.find_element_by_name('code')
search.click()
search.send_keys("1830")
search.send_keys(Keys.RETURN)
element = driver.find_element_by_link_text('Financials')
element.click()
element = driver.find_elements_by_link_text('Annual Report')
element.click()
Here's my error
AttributeError: 'list' object has no attribute 'click'
As I said above. By removing the s in 'elements' it works fine but only opens the first 'Annual Report'.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…