If i do test local i can find the element with
The test look like this.
The Copy --> Selector or XPath.
Usage then is.
Toner
text and click to execute the JavaScript code.The test look like this.
local_javascript.html
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>Title of the document</title> </head> <body> <h1>Hello world test</h1> <a href="javascript:alert('Hello World!');">Toner</a> </body> </html>
from selenium import webdriver from selenium.webdriver.chrome.options import Options import time options = Options() #options.add_argument("--headless") #options.add_argument("window-size=398,256") browser = webdriver.Chrome(executable_path=r'C:\cmder\bin\chromedriver.exe', options=options) browser.get('file:///E:/div_code/scrape/sel_screenhot/local_javascript.html') time.sleep(5) I_want_click_on_link = browser.find_element_by_link_text("Toner").click()How dos rest of html look when load it browser?
http://10.27.20.49/web/guest/br/websys/webArch/mainFrame.cgiCould try to locate bye CSS selector or Xpath,right click
inspect
when over tag in dev tools.The Copy --> Selector or XPath.
Usage then is.
I_want_click_on_link = driver.find_element_by_css_selector('.something') I_want_click_on_link[0].click()