Q:

python selenium, selecting links with same target

Hey my project is this:

Select all links with target=Map
Store/convert www.streetmap.co.uk location to lat/longitude
Upload all to google maps

I'm getting stuck on step 1, can't even select the link and click it, please help
from selenium import webdriver

path_to_chromedriver = r'C:\Users\Kane\Desktop\chromedriver_win32\chromedriver.exe'
browser = webdriver.Chrome(executable_path = path_to_chromedriver)

url = 'http://www.fieldmycology.net/FRDBI/FRDBIrecord.asp?intGBNum=1511'
browser.get(url)
link = browser.find_element_by_xpath['//a[contains(@target = '"Map"')]']
link.click()

A:

As stated by @Gaurang Shah in the comments, you have to use find_elements_by_xpath
from selenium import webdriver

path_to_chromedriver = r'C:\Users\Kane\Desktop\chromedriver_win32\chromedriver.exe'
browser = webdriver.Chrome(executable_path = path_to_chromedriver)

url = 'http://www.fieldmycology.net/FRDBI/FRDBIrecord.asp?intGBNum=1511'
browser.get(url)
links = browser.find_elements_by_xpath['//a[contains(@target = '"Map"')]']
for link in links:
    link.click()

