2

Trying to see what methods are available on my main object when using the selenium library. I can see that they exist when I call the dir() function on my object but pycharm doesn't suggest these to me automatically. I followed the steps laid out in a similar question I'll link below but that didn't work. I'll post my code below and an example of what I mean.

from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
import time

PATH = "C:\Program Files (x86)\chromedriver.exe"
driver = webdriver.Chrome(PATH)


driver.get("https://www.techwithtim.net")

search = driver.find_element_by_name("s")
search.send_keys("test")
search.send_keys(Keys.RETURN)


# Explict Wait
try:
    main = WebDriverWait(driver, 10).until(
        EC.presence_of_element_located((By.ID, "main"))
    )
    # Code I'd like to autocomplete.
    articles = main.find

except:
    driver.quit()

This post answer did not work: Why isn't PyCharm's autocomplete working for libraries I install?

Example shown in a video by TechWithTim: Example of the autocompletion I'm looking for

My Python Interpreter settings: My Python Interpreter settings

More Interpreter Settings

  • Not sure why yours doesn't work. For example if I clicked `EC.` it would show the full list of items I can choose from in autocomplete. I didn't think this was an interpreter thing, I thought it was automatic if you had the library installed. The only thing I can think of is if you have the packages installed into a virtual environment and Pycharm doesn't know about it and is pointing somewhere else. If that were the case though I would think the script would fail – JD2775 May 02 '21 at 00:02
  • Try File -> Invalidate caches – vitaliis May 02 '21 at 00:52
  • Invalidating and restarting didn't seem to do the trick... – Denzel Hooke May 02 '21 at 01:02
  • Try Manage IDE settings -> Restore default settings – vitaliis May 02 '21 at 04:54

0 Answers0