3

I am unable to click ShowDates button from the url through automation .

I am trying to read web element(through button id/class) as shown below

    let SHOW_DATES_BUTTON = By.css('.btn-secondary.btn-sub-action.show-dates-button');

    async ShowDatesButton(){
                return await this.baseClassWebDriver.wait(Until.elementsLocated(SHOW_DATES_BUTTON));
        }

async go(){
        let demoSRPage = new DemoSRPage(this.url, this.baseClassWebDriver);
            await demoSRPage.go().then(async () => {
                    await demoSRPage.showDatesButton().then(async (showDateBtn) => {
                        await showDateBtn.click().then(async () => {
                            pause(20000);
                              await demoSRPage.getLastHandle(demoSRPage.baseClassWebDriver);
                    });
                });
            });
    }

I am getting an error : showDateBtn.click() is not a function

Can somebody please help me through

  • 1
    It's possible the element was not found and you got a null returned. Check [if element exists](https://stackoverflow.com/questions/25753014/selenium-webdriver-wait-till-element-is-displayed). – lloyd Mar 27 '18 at 08:23

0 Answers0