Quantcast
Channel: Active questions tagged html - Stack Overflow
Viewing all articles
Browse latest Browse all 74045

My vba code doesn't work because I can't locate my element ID. won't work through the class name either. I wish to populate text box and hit send

$
0
0

Here is my vba code.

It works up until the point where I also keep getting messages that say object has disconnected from its client. I don't want to use sendkeys or Selenium as my colleagues will not be able to duplicate and run this form then. I wish to make it robust.

Sub exceltoweb()
Dim IE As Object
Set IE = CreateObject("InternetExplorer.Application")
IE.navigate "https://fans-dub.amazon.com/"
IE.Visible = True
While IE.Busy
Do
DoEvents
Loop Until IE.readyState = READYSTATE_COMPLETE
Wend

delay 5
IE.document.all("submitterId").Value = ("fahac")
delay 2
IE.document.all("to").Value = ("ceezeala")
delay 3
IE.document.all("messageText").Value = ("10 errors")
delay 3
IE.document.all("/images/send-button.gif").Click

Application.StatusBar = "Form Submitted"
Set IE = Nothing
Application.ScreenUpdating = True
End Sub

This is the HTML:

id="simpleSendMessageForm" method="post">
        <div id="outerDiv">
          <label>From:</label>
          <div class="formElement">
            <input name="submitterId" type="text" size="16" value="fahac" readonly />
          </div>
          <div class="break"></div>
          <label>
            <abbr title="A comma separated list of user ids who will receive this message">To:</abbr>
          </label>
          <div class="formElement">
            <input name="to" type="text" size="16" value="" />
          </div>
          <div class="break"></div>
          <label>
            <abbr title="A comma separated list of manager's user ids. The message will be sent to all people who report directly to one of these managers">Direct reports of:</abbr>
          </label>
          <div class="formElement">
            <input name="directReports" type="text" size="16" />
          </div>
          <div class="break"></div>
          <textarea rows="5" name="messageText"></textarea>
        </div>
        <div class="break"></div>
        <span class="right"> 
          <span id="ssmf-loading" class="ajaxloading"><img src="/images/ajax-loading.gif" alt="Loading..." /></span>
          <input type="image" src="/images/send-button.gif" />
        </span>
      </form>
    </div>
  </fieldset>
</div>

<!-- SEARCH -->
<!-- Search tab is excluded from EU pages for compliance with European data protection law -->


<div class="clear"></div>
<!-- MESSAGE LIST -->
<div class="qsection">
  <fieldset class="roundborder snx2">
    <legend id="messageListTitle" class="qsectionTitle">My Messages (Last 3 days)</legend>

      <div id="myMessages" class="qsectionBody">

The boxes I want to enter a text into does not have an ID, just names. I wish to populate 3 boxes and hit send for which the send does not have ID either.


Viewing all articles
Browse latest Browse all 74045

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>