I am new to the forum and have some VBA experience, but not a lot.
I am using Selenium to facilitate interaction with a Chrome site with the aim of automating a series of requests to the site (Starleaf Web meetings) with the data in an Excel spreadsheet.
I can log in fine and can navigate from page to page using FindElementByID
and FindElementByTag("a").Click
statements.
I have a problem with navigating using this approach on one page. I have tried ByID(the first 2 IDs in the code below)
, ByLinkText
, ByClass (portalContent, button, single)
, ByCssSelector
; but nothing works. The macro stalls on code line of this form:
Set elem = bot.FindElementBy*****("Parameter")
elem.FindElementByTag("a").Click
The code on the page in question is:
<div class="portalContent">
<div id="viewConferencesAddDiv" class="buttons single" style="">
<a id="viewConferences_add" href="https://portal.starleaf.com/#page=addUserConference" target="_parent">
<span id="viewConferences_add_text">Schedule meeting</span>
</a>
</div>
I wondered if the id="viewConferences_add"
between the 'a' tag and the href might be the problem but I am not sure how to get round this.
An alternative approach that I have tried to use is to go directly to the page I need after login however this does not seem to work. I may have a syntax problem???
Here's what I tried:
bot.Get "/#page=addUserConference"
bot.Get "https://portal.starleaf.com/#page=addUserConference"
bot.Get "//portal.starleaf.com/#page=addUserConference"
With this code afterwards to allow time for the page to load:
Do Until InStr(1, bot.Url, "addUserConference") > 0
Application.Wait (DateAdd("s", 1, Now))
DoEvents
Loop
Update
I was looking around and found someone talking about iframe switching. Looking at the page in F12 it does actually look as thought the 'Schedule Meeting' button might be in an iframe. The suggestion was to switch to if however I have no idea how to do that. There appear to be several iframes on the page - so I guess I need the ID. I think it might be id=mainPanel_iframe.
HTML of the iframe tag:
<iframe id="mainPanel_iframe" name="mainPanel_iframe" class="mochaIframe" src="https://portal.starleaf.com/pbx/node-1.live.pr.starleaf.com/portal/#page=users&lang=en_int" marginwidth="0" marginheight="0" frameborder="0" scrolling="auto" style="height: 579px; width: 1543px;"></iframe>