0

Im getting: AttributeError: 'WebDriver' object has no attribute 'getwindowhandles'

when trying

 Whandles = driver.getWindowHandles()
 print(Whandles)

these are my imports:

import sys
from PyQt5 import QtCore, QtGui, QtWidgets
from ui.css import Ui_Dialog
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.chrome.options import Options
from selenium.common.exceptions import NoSuchElementException
import time

Am I missing something?

Travinns
  • 263
  • 1
  • 3
  • 13

1 Answers1

8

The exception is telling you that there is no method getWindowHandles() on the driver class. What you need is

Whandles = driver.window_handles

When you see this type of exception, do a print(dir(driver)) to see what methods are supported by the class.

Ron Norris
  • 2,642
  • 1
  • 9
  • 13