Error select.select_by_visible_text('Jan 2018')

0 votes
My code was working fine earlier but now when I run the code I get the following error in my console:

C:\Users\Documents\NetBeansProjects\BudgetHome>python cmpm.py

download_dir is not empty! Will now attempt to delete all files

All files have been removed from C:\Users\Documents\NetBeansProjects\Budg

etHome\downloads

Download Directory: C:\Users\Documents\NetBeansProjects\BudgetHome\downlo

ads

Opening Chrome

 

DevTools listening on ws://127.0.0.1:12019/devtools/browser/96faa11d-113e-444d-9

fb0-70dee233185e

Authenicating

Load CMPM home

Opening CMPM Datamart reports

elem clicked

Attemting to switch to frame 0

New window should be opening

Waiting for window to load, waiting 60 seconds

Found elem: <selenium.webdriver.remote.webelement.WebElement (session="06457076a

856edb1022910e647d858af", element="0.12555711894711363-1")>

Fililng out form for: xxxxxx

Traceback (most recent call last):

  File "cmpm.py", line 164, in <module>

    fetch_data()                #---    WORKS --- 3/20/12

  File "cmpm.py", line 138, in fetch_data

    select_date(driver, months)

  File "cmpm.py", line 100, in select_date

    select.select_by_visible_text("Jan 2018")

AttributeError: 'Select' object has no attribute 'select_by_visible_text'

 

C:\Users\Documents\NetBeansProjects\BudgetHome>

I have tried everything I have found thus far to make this work to no avail. Here is my existing code that worked:

from selenium.webdriver.support.ui import Select

months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']

 

def select_date(driver, months):        #NEED IT TO SELECT STARTDATE AND CHANGE IT TO JAN 2018 below works as of Feb 7th

    for months in months:

        elem = WebDriverWait(driver, wait_time).until(EC.presence_of_element_located((By.CSS_SELECTOR, 'button[name="btnSubmit"]')))

        select = Select(driver.find_element_by_name('startdate'))

        select.select_by_visible_text("Jan 2018")
Jul 31, 2018 in Selenium by Martin
• 4,210 points
133 views

1 answer to this question.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
0 votes

Your import statement is incorrect. As of 3.9, it should be

from selenium.webdriver.support.select import Select

not selenium.webdriver.support.ui

answered Jul 31, 2018 by Samarpit
• 5,130 points

Related Questions In Selenium

0 votes
1 answer

TestNG error:- Cannot find class in classpath

The issue is because the project directory ...READ MORE

answered Mar 23, 2018 in Selenium by nsv999
• 5,030 points
4,194 views
+1 vote
1 answer

Nightwatch chromedriver error

You should use a dot before lib: "webdriver.chrome.driver" ...READ MORE

answered Mar 25, 2018 in Selenium by nsv999
• 5,030 points
281 views
0 votes
1 answer

Selenium XPath error:- Element not found

The reason for Element not found exception ...READ MORE

answered Mar 27, 2018 in Selenium by nsv999
• 5,030 points
1,470 views
0 votes
1 answer

Finding WebDriver element with Class Name in java

The better way to handle this element ...READ MORE

answered Apr 10, 2018 in Selenium by nsv999
• 5,030 points
56 views
0 votes
1 answer
0 votes
1 answer

Geo-location microphone camera pop up

To Allow or Block the notification, access using Selenium and you have to ...READ MORE

answered May 11, 2018 in Selenium by Samarpit
• 5,130 points
420 views
0 votes
1 answer

How to use such xpath to find web elements

It's much simpler to use: #MyDiv123 > div.super or ...READ MORE

answered Jun 14, 2018 in Selenium by Samarpit
• 5,130 points
43 views
0 votes
1 answer

How to eliminate this error”Cannot instantiate the type Select in selenium webdriver”

Try below code. Select sc = new Select(driver.findElement(By.xpath("your ...READ MORE

answered May 18, 2018 in Selenium by Samarpit
• 5,130 points
990 views
0 votes
1 answer

© 2018 Brain4ce Education Solutions Pvt. Ltd. All rights Reserved.
"PMP®","PMI®", "PMI-ACP®" and "PMBOK®" are registered marks of the Project Management Institute, Inc. MongoDB®, Mongo and the leaf logo are the registered trademarks of MongoDB, Inc.