I am trying to run Python / Selenium script that clicks a font awesome button on a static HTML website.
I've tried several ID names but I keep getting exceptions.
When I right click and 'inspect element' the ID tag is what I have enetered currently.
I don't want to use xpath.
Any help would be greatly appreciated, thanks.
Python script:
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
import time
import unittest
driver = webdriver.Chrome()
driver.get("http://www.baransjd.com")
time.sleep(2)
driver.find_element_by_id("i.fa.fa-linkedin-square.fa-2x")
click()
time.sleep(2)
driver.close()
HTML for the font awesome button (no CSS)
<a target="_blank" href="https://www.linkedin.com/in/dan-b-33b89b158/"> <i class="fa fa-linkedin-square fa-2x" style="color:#5B5B5B"></i></a>
"i.fa.fa-linkedin-square.fa-2x"is a CSS selector. So, usingfind_element_by_idwon't work. Usefind_element_by_css_selectorinstead.driver.find_element_by_css_selector("i.fa.fa-linkedin-square.fa-2x").click().