无法使用VBA从javascript下拉菜单中单击或选择项目

时间:2017-11-23 16:35:30

标签: javascript html vba

正如标题所示,我找到了我要点击的按钮的ClassName(我想,因为该ClassName数组的innertext#给了我按钮上显示的正确文本)。问题是,我点击它却没有做任何事情。 这是几十次中我最好的尝试,但它没有做任何事情。

For Each i In IE.document.getElementById("typeSelector")
    If i.innerText = "Revenue" Then
        i.Click
        i.FireEvent ("onchange")
        'This click and fireEvent are activated but do nothing.
    End If
Next i

'接下来的那些是冰雹玛丽的堆叠在一起,看看我是否从那该死的盒子里得到了反应。纳达。

   Debug.Print IE.document.getElementsByClassName("chzn-single chzn-default")(0).innerText  'Prints "Select an option". I thought clicking this would at least open the drop down menu but still, nothing.
    Debug.Print IE.document.getElementById("typeSelector_chzn_o_14").innerText 'Prints "Revenue". This is the option within the dropdown menu, shown after clicking the menu when manually done.
    IE.document.getElementsByClassName("chzn-single chzn-default")(0).Click
    IE.document.getElementById("typeSelector_chzn_o_14").Click

总而言之,我尝试根据索引激活该选项,单击该框,单击该框,然后单击“收入”选项。该网站仍然完全无动于衷。需要注意的是,成功点击不会更新网站,只需突出显示菜单中的“收入”选项,然后打开日期输入框。

0 个答案:

没有答案