VBA Web Automation on a dynamic site










0














I am trying to scrap barcode owners from this site : http://gepir.gs1.org/index.php/search-by-gtin



I am receiving "Object doesnt support this property or method" error msg because of the final line. I tried to extract it with class and tag but failed.



I am trying to extract the company name from the dynamic table.



Sub aa()

Dim ie As New SHDocVw.InternetExplorer
Dim doc As HTMLDocument
Dim aaa As Object
Dim objIE As InternetExplorer
Set objIE = New InternetExplorer

ie.Visible = True
ie.navigate "gepir.gs1.org/index.php/search-by-gtin"

Do While ie.readyState <> READYSTATE_COMPLETE
Loop

Debug.Print ie.LocationName, ie.LocationURL

Set doc = ie.document

ie.document.forms("searchbygtin").elements("keyValue").Value = "685387379712"
ie.document.forms("searchbygtin").elements("method").Click

Debug.Print ie.document.getElementsBytag("tr")(7).innerText

End Sub


Any help would be great,
Thanks










share|improve this question




























    0














    I am trying to scrap barcode owners from this site : http://gepir.gs1.org/index.php/search-by-gtin



    I am receiving "Object doesnt support this property or method" error msg because of the final line. I tried to extract it with class and tag but failed.



    I am trying to extract the company name from the dynamic table.



    Sub aa()

    Dim ie As New SHDocVw.InternetExplorer
    Dim doc As HTMLDocument
    Dim aaa As Object
    Dim objIE As InternetExplorer
    Set objIE = New InternetExplorer

    ie.Visible = True
    ie.navigate "gepir.gs1.org/index.php/search-by-gtin"

    Do While ie.readyState <> READYSTATE_COMPLETE
    Loop

    Debug.Print ie.LocationName, ie.LocationURL

    Set doc = ie.document

    ie.document.forms("searchbygtin").elements("keyValue").Value = "685387379712"
    ie.document.forms("searchbygtin").elements("method").Click

    Debug.Print ie.document.getElementsBytag("tr")(7).innerText

    End Sub


    Any help would be great,
    Thanks










    share|improve this question


























      0












      0








      0







      I am trying to scrap barcode owners from this site : http://gepir.gs1.org/index.php/search-by-gtin



      I am receiving "Object doesnt support this property or method" error msg because of the final line. I tried to extract it with class and tag but failed.



      I am trying to extract the company name from the dynamic table.



      Sub aa()

      Dim ie As New SHDocVw.InternetExplorer
      Dim doc As HTMLDocument
      Dim aaa As Object
      Dim objIE As InternetExplorer
      Set objIE = New InternetExplorer

      ie.Visible = True
      ie.navigate "gepir.gs1.org/index.php/search-by-gtin"

      Do While ie.readyState <> READYSTATE_COMPLETE
      Loop

      Debug.Print ie.LocationName, ie.LocationURL

      Set doc = ie.document

      ie.document.forms("searchbygtin").elements("keyValue").Value = "685387379712"
      ie.document.forms("searchbygtin").elements("method").Click

      Debug.Print ie.document.getElementsBytag("tr")(7).innerText

      End Sub


      Any help would be great,
      Thanks










      share|improve this question















      I am trying to scrap barcode owners from this site : http://gepir.gs1.org/index.php/search-by-gtin



      I am receiving "Object doesnt support this property or method" error msg because of the final line. I tried to extract it with class and tag but failed.



      I am trying to extract the company name from the dynamic table.



      Sub aa()

      Dim ie As New SHDocVw.InternetExplorer
      Dim doc As HTMLDocument
      Dim aaa As Object
      Dim objIE As InternetExplorer
      Set objIE = New InternetExplorer

      ie.Visible = True
      ie.navigate "gepir.gs1.org/index.php/search-by-gtin"

      Do While ie.readyState <> READYSTATE_COMPLETE
      Loop

      Debug.Print ie.LocationName, ie.LocationURL

      Set doc = ie.document

      ie.document.forms("searchbygtin").elements("keyValue").Value = "685387379712"
      ie.document.forms("searchbygtin").elements("method").Click

      Debug.Print ie.document.getElementsBytag("tr")(7).innerText

      End Sub


      Any help would be great,
      Thanks







      html excel vba web-scraping webautomation






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 12 at 7:21









      Pᴇʜ

      20.2k42650




      20.2k42650










      asked Nov 11 at 18:23









      Çağan Aceter

      32




      32






















          1 Answer
          1






          active

          oldest

          votes


















          0














          You need TagName



          Debug.Print ie.document.getElementsByTagName("tr")(7).innerText


          I get a captcha though so I doubt you can complete this task in this way. Selenium and IE both seem to trigger the captcha, at least for me.




          If not for the captcha I would re-write your script as follows (perhaps with a loop to make sure tr element is present):



          Option Explicit

          Public Sub GetLastChangeDate()
          Dim ie As New SHDocVw.InternetExplorer, doc As HTMLDocument
          Const URL = "gepir.gs1.org/index.php/search-by-gtin"

          With ie
          .Visible = True
          .navigate URL

          While .Busy Or .readyState < 4: DoEvents: Wend

          Set doc = .document

          Debug.Print .LocationName, .LocationURL

          doc.getElementById("keyValue").Value = "685387379712"
          doc.getElementById("submit-button").Click

          While .Busy Or .readyState < 4: DoEvents: Wend

          Debug.Print .document.getElementsByTagName("tr")(7).innerText
          End With
          End Sub





          share|improve this answer






















          • Many thanks for that, I am still receiving "Object doesn't support this property or method" msg, did the code work for you?
            – Çağan Aceter
            Nov 11 at 20:18










          • Sorry that is the error msg "Object variable or With block variable not set"
            – Çağan Aceter
            Nov 11 at 20:26










          • Yes. But I have to manually complete the autocaptcha on screen and then F8 back through the code to click the button and then retrieve Last Change DateApr. 18, 2015
            – QHarr
            Nov 11 at 20:27






          • 1




            That error message happens because there is a captcha you cannot get past with automation in this way. In fact in anyway I know except with a complex robot beyond my abilities to program. You will need to find a different way. Is there an API? The original problem you had was because of the missing Name part though.
            – QHarr
            Nov 11 at 20:28











          • Let me know if you consider this answered. When IE opens and you scroll down do you see the captcha?
            – QHarr
            Nov 11 at 20:43










          Your Answer






          StackExchange.ifUsing("editor", function ()
          StackExchange.using("externalEditor", function ()
          StackExchange.using("snippets", function ()
          StackExchange.snippets.init();
          );
          );
          , "code-snippets");

          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "1"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53251812%2fvba-web-automation-on-a-dynamic-site%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          0














          You need TagName



          Debug.Print ie.document.getElementsByTagName("tr")(7).innerText


          I get a captcha though so I doubt you can complete this task in this way. Selenium and IE both seem to trigger the captcha, at least for me.




          If not for the captcha I would re-write your script as follows (perhaps with a loop to make sure tr element is present):



          Option Explicit

          Public Sub GetLastChangeDate()
          Dim ie As New SHDocVw.InternetExplorer, doc As HTMLDocument
          Const URL = "gepir.gs1.org/index.php/search-by-gtin"

          With ie
          .Visible = True
          .navigate URL

          While .Busy Or .readyState < 4: DoEvents: Wend

          Set doc = .document

          Debug.Print .LocationName, .LocationURL

          doc.getElementById("keyValue").Value = "685387379712"
          doc.getElementById("submit-button").Click

          While .Busy Or .readyState < 4: DoEvents: Wend

          Debug.Print .document.getElementsByTagName("tr")(7).innerText
          End With
          End Sub





          share|improve this answer






















          • Many thanks for that, I am still receiving "Object doesn't support this property or method" msg, did the code work for you?
            – Çağan Aceter
            Nov 11 at 20:18










          • Sorry that is the error msg "Object variable or With block variable not set"
            – Çağan Aceter
            Nov 11 at 20:26










          • Yes. But I have to manually complete the autocaptcha on screen and then F8 back through the code to click the button and then retrieve Last Change DateApr. 18, 2015
            – QHarr
            Nov 11 at 20:27






          • 1




            That error message happens because there is a captcha you cannot get past with automation in this way. In fact in anyway I know except with a complex robot beyond my abilities to program. You will need to find a different way. Is there an API? The original problem you had was because of the missing Name part though.
            – QHarr
            Nov 11 at 20:28











          • Let me know if you consider this answered. When IE opens and you scroll down do you see the captcha?
            – QHarr
            Nov 11 at 20:43















          0














          You need TagName



          Debug.Print ie.document.getElementsByTagName("tr")(7).innerText


          I get a captcha though so I doubt you can complete this task in this way. Selenium and IE both seem to trigger the captcha, at least for me.




          If not for the captcha I would re-write your script as follows (perhaps with a loop to make sure tr element is present):



          Option Explicit

          Public Sub GetLastChangeDate()
          Dim ie As New SHDocVw.InternetExplorer, doc As HTMLDocument
          Const URL = "gepir.gs1.org/index.php/search-by-gtin"

          With ie
          .Visible = True
          .navigate URL

          While .Busy Or .readyState < 4: DoEvents: Wend

          Set doc = .document

          Debug.Print .LocationName, .LocationURL

          doc.getElementById("keyValue").Value = "685387379712"
          doc.getElementById("submit-button").Click

          While .Busy Or .readyState < 4: DoEvents: Wend

          Debug.Print .document.getElementsByTagName("tr")(7).innerText
          End With
          End Sub





          share|improve this answer






















          • Many thanks for that, I am still receiving "Object doesn't support this property or method" msg, did the code work for you?
            – Çağan Aceter
            Nov 11 at 20:18










          • Sorry that is the error msg "Object variable or With block variable not set"
            – Çağan Aceter
            Nov 11 at 20:26










          • Yes. But I have to manually complete the autocaptcha on screen and then F8 back through the code to click the button and then retrieve Last Change DateApr. 18, 2015
            – QHarr
            Nov 11 at 20:27






          • 1




            That error message happens because there is a captcha you cannot get past with automation in this way. In fact in anyway I know except with a complex robot beyond my abilities to program. You will need to find a different way. Is there an API? The original problem you had was because of the missing Name part though.
            – QHarr
            Nov 11 at 20:28











          • Let me know if you consider this answered. When IE opens and you scroll down do you see the captcha?
            – QHarr
            Nov 11 at 20:43













          0












          0








          0






          You need TagName



          Debug.Print ie.document.getElementsByTagName("tr")(7).innerText


          I get a captcha though so I doubt you can complete this task in this way. Selenium and IE both seem to trigger the captcha, at least for me.




          If not for the captcha I would re-write your script as follows (perhaps with a loop to make sure tr element is present):



          Option Explicit

          Public Sub GetLastChangeDate()
          Dim ie As New SHDocVw.InternetExplorer, doc As HTMLDocument
          Const URL = "gepir.gs1.org/index.php/search-by-gtin"

          With ie
          .Visible = True
          .navigate URL

          While .Busy Or .readyState < 4: DoEvents: Wend

          Set doc = .document

          Debug.Print .LocationName, .LocationURL

          doc.getElementById("keyValue").Value = "685387379712"
          doc.getElementById("submit-button").Click

          While .Busy Or .readyState < 4: DoEvents: Wend

          Debug.Print .document.getElementsByTagName("tr")(7).innerText
          End With
          End Sub





          share|improve this answer














          You need TagName



          Debug.Print ie.document.getElementsByTagName("tr")(7).innerText


          I get a captcha though so I doubt you can complete this task in this way. Selenium and IE both seem to trigger the captcha, at least for me.




          If not for the captcha I would re-write your script as follows (perhaps with a loop to make sure tr element is present):



          Option Explicit

          Public Sub GetLastChangeDate()
          Dim ie As New SHDocVw.InternetExplorer, doc As HTMLDocument
          Const URL = "gepir.gs1.org/index.php/search-by-gtin"

          With ie
          .Visible = True
          .navigate URL

          While .Busy Or .readyState < 4: DoEvents: Wend

          Set doc = .document

          Debug.Print .LocationName, .LocationURL

          doc.getElementById("keyValue").Value = "685387379712"
          doc.getElementById("submit-button").Click

          While .Busy Or .readyState < 4: DoEvents: Wend

          Debug.Print .document.getElementsByTagName("tr")(7).innerText
          End With
          End Sub






          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Nov 11 at 19:08

























          answered Nov 11 at 18:53









          QHarr

          30k81841




          30k81841











          • Many thanks for that, I am still receiving "Object doesn't support this property or method" msg, did the code work for you?
            – Çağan Aceter
            Nov 11 at 20:18










          • Sorry that is the error msg "Object variable or With block variable not set"
            – Çağan Aceter
            Nov 11 at 20:26










          • Yes. But I have to manually complete the autocaptcha on screen and then F8 back through the code to click the button and then retrieve Last Change DateApr. 18, 2015
            – QHarr
            Nov 11 at 20:27






          • 1




            That error message happens because there is a captcha you cannot get past with automation in this way. In fact in anyway I know except with a complex robot beyond my abilities to program. You will need to find a different way. Is there an API? The original problem you had was because of the missing Name part though.
            – QHarr
            Nov 11 at 20:28











          • Let me know if you consider this answered. When IE opens and you scroll down do you see the captcha?
            – QHarr
            Nov 11 at 20:43
















          • Many thanks for that, I am still receiving "Object doesn't support this property or method" msg, did the code work for you?
            – Çağan Aceter
            Nov 11 at 20:18










          • Sorry that is the error msg "Object variable or With block variable not set"
            – Çağan Aceter
            Nov 11 at 20:26










          • Yes. But I have to manually complete the autocaptcha on screen and then F8 back through the code to click the button and then retrieve Last Change DateApr. 18, 2015
            – QHarr
            Nov 11 at 20:27






          • 1




            That error message happens because there is a captcha you cannot get past with automation in this way. In fact in anyway I know except with a complex robot beyond my abilities to program. You will need to find a different way. Is there an API? The original problem you had was because of the missing Name part though.
            – QHarr
            Nov 11 at 20:28











          • Let me know if you consider this answered. When IE opens and you scroll down do you see the captcha?
            – QHarr
            Nov 11 at 20:43















          Many thanks for that, I am still receiving "Object doesn't support this property or method" msg, did the code work for you?
          – Çağan Aceter
          Nov 11 at 20:18




          Many thanks for that, I am still receiving "Object doesn't support this property or method" msg, did the code work for you?
          – Çağan Aceter
          Nov 11 at 20:18












          Sorry that is the error msg "Object variable or With block variable not set"
          – Çağan Aceter
          Nov 11 at 20:26




          Sorry that is the error msg "Object variable or With block variable not set"
          – Çağan Aceter
          Nov 11 at 20:26












          Yes. But I have to manually complete the autocaptcha on screen and then F8 back through the code to click the button and then retrieve Last Change DateApr. 18, 2015
          – QHarr
          Nov 11 at 20:27




          Yes. But I have to manually complete the autocaptcha on screen and then F8 back through the code to click the button and then retrieve Last Change DateApr. 18, 2015
          – QHarr
          Nov 11 at 20:27




          1




          1




          That error message happens because there is a captcha you cannot get past with automation in this way. In fact in anyway I know except with a complex robot beyond my abilities to program. You will need to find a different way. Is there an API? The original problem you had was because of the missing Name part though.
          – QHarr
          Nov 11 at 20:28





          That error message happens because there is a captcha you cannot get past with automation in this way. In fact in anyway I know except with a complex robot beyond my abilities to program. You will need to find a different way. Is there an API? The original problem you had was because of the missing Name part though.
          – QHarr
          Nov 11 at 20:28













          Let me know if you consider this answered. When IE opens and you scroll down do you see the captcha?
          – QHarr
          Nov 11 at 20:43




          Let me know if you consider this answered. When IE opens and you scroll down do you see the captcha?
          – QHarr
          Nov 11 at 20:43

















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.





          Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


          Please pay close attention to the following guidance:


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53251812%2fvba-web-automation-on-a-dynamic-site%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Use pre created SQLite database for Android project in kotlin

          Darth Vader #20

          Ondo