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,320 points
3,318 views

1 answer to this question.

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,910 points

Related Questions In Selenium

0 votes
2 answers

TestNG error:- Cannot find class in classpath

The above link didn't work it means ...READ MORE

answered Feb 12, 2020 in Selenium by Rashmi Reddy PR
40,977 views
+1 vote
1 answer

Nightwatch chromedriver error

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

answered Mar 26, 2018 in Selenium by nsv999
• 5,500 points
2,729 views
–1 vote
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,500 points
20,494 views
0 votes
2 answers

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,500 points
13,669 views
0 votes
2 answers

Problem while using InternetExplorerDriver in Selenium WebDriver

enable trusted connection  in internet explorer by ...READ MORE

answered Aug 31, 2020 in Selenium by Sri
• 3,190 points
9,140 views
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,910 points
7,219 views
0 votes
2 answers

How to use such xpath to find web elements

xpath are two types. 1) Absolute XPath:    /html/b ...READ MORE

answered Sep 3, 2020 in Selenium by Sri
• 3,190 points
7,872 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,910 points
9,976 views
0 votes
1 answer
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP