0

I'm trying to write a python3 code which will open a internal website of Innovaphone and click on the link and then click a button to activate it. I need to do this after 99 hours.

I'm getting error.

Missing module docstring.

Instance of 'Webdriver' has no 'find_element_by_link_text' member

selenium.common.exceptions.WebDriverException: Message: 'geckodriver' executable needs to be in PATH.

I tried the below code;

from selenium import webdriver
browser= webdriver.Firefox()
browser.get('https://192.168.1.1/')
new_releases = browser.find_element_by_link_text('New Releases')
new_releases.click()

There is a clickable link in the webpage and I don't know how to get the link elements.

Thank you for all your help.

  • See this. This question is already answered. [click here](https://stackoverflow.com/questions/72773206/selenium-python-attributeerror-webdriver-object-has-no-attribute-find-el) – Ashutosh Yadav Dec 12 '22 at 10:08
  • Does this answer your question? [Selenium - Python - AttributeError: 'WebDriver' object has no attribute 'find\_element\_by\_name'](https://stackoverflow.com/questions/72773206/selenium-python-attributeerror-webdriver-object-has-no-attribute-find-el) – Ashutosh Yadav Dec 12 '22 at 10:09

1 Answers1

0

As the error suggest find_element_by_link_text is not a function of the web driver.

You can try getting the link you are looking for by XPath. You can copy the XPath from your browser to right click on the element in the browser. Clicking inspect (will highlight the element in the inspect menu). Right Click -> Copy -> Copy XPath (or similar).

In selenium you can then use

new_releases = browser.find_element(By.XPATH, **YOUR XPATH**)
new_releases[0].click()

Note that you may need to import By from selenium (Don't know which subpackage to be exact).

EDIT: By package is located in selenium.webdriver.common.by

EDIT 2: Misread the initial issue. It seems that you do not have geckodriver added to Path (placing it in project is not enough).

See post below for more information:

Selenium using Python - Geckodriver executable needs to be in PATH

You will basically have to download the geckodriver, define the relative path inside you project (to allow it to work on different computers) and go from there (see first answer).