Search code examples
excelvbaselenium-webdriverselenium-chromedriver

Selenium cd.FindElementByClass("").Click


I am struggling with getting proper item to action on my click event.

Context: I have been able to locate, or I think that I have, the appropriate item to click... Looking at the button class "css-z4yfkz", I'm able to click it. However, rather than getting the Day-Of Ops Plan, the Pick Orders gets downloaded... So I noticed while watching the item, when I click the Day-Of Ops Plan button, another class item quickly opens, which I've been able to snag.

So, at the bottom of the page, I'm attempting to click the "Day-Of Ops" Plan button.

Page Buttons

When using the cd.FindElementByClass ("css-z4yfkz").Click, I'm getting the "Pick Order" button, i.e. downloaded file...

Initial Code

What I have found through further review, is that when I click the "Day-Of Ops Plan" button, a subsequent class object appears "css-5ssczt". However, without the click, I'm unable to locate it. So I attempted to sequence consecutive clicks w/o success.

cd.FindElementByClass ("css-z4yfkz").Click
cd.FindElementByClass ("css-5ssczt").Click

Activated Code

Is there a method for getting to this item, such that I can click it? I've temporarily generated a workaround using the SeleniumWrapper.Keys, but this is not a good long term solution.

As a note, I got the same result using

cd.FindElementByXPath("//button[@class ='css-z4yfkz']").Click

Thank you, in advance, for your time and contribution.

As noted above, I have attempted to use both Class names, the prior results in a download that comes from the Pick Order button. As I stated, I was able to capture the "<div class="css-5ssczt" that occurs when the button is clicked, but I'm not able to find it, nor able to create the action to engage it...

Activated Code


Solution

  • My temporary answer is to use SendKeys as follows.

    cd.FindElementByXPath("//button[@class='css-z4yfkz']").SendKeys("{TAB}{ENTER}").Click