Access web page body text using VBA & Selenium











up vote
0
down vote

favorite












I am trying to convert an Excel macro that currently uses Internet Explorer and use the following line of code to extract the web page’s <body> text



x = .Document.DocumentElement.InnerText


Using the Selenium demo, I am able to produce a jpg of the page with Chrome & IE, but Firefox just loads a blank page and IE64 & Edge don’t work on Windows 10.



I have been unable to find the proper VBA command with Selenium to copy the body text to variable ”x”. I only want to read it.



I am trying to do this to make my macro browser independent.



The macro is for my use only.



Jim










share|improve this question









New contributor




Jim Dell is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
























    up vote
    0
    down vote

    favorite












    I am trying to convert an Excel macro that currently uses Internet Explorer and use the following line of code to extract the web page’s <body> text



    x = .Document.DocumentElement.InnerText


    Using the Selenium demo, I am able to produce a jpg of the page with Chrome & IE, but Firefox just loads a blank page and IE64 & Edge don’t work on Windows 10.



    I have been unable to find the proper VBA command with Selenium to copy the body text to variable ”x”. I only want to read it.



    I am trying to do this to make my macro browser independent.



    The macro is for my use only.



    Jim










    share|improve this question









    New contributor




    Jim Dell is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.






















      up vote
      0
      down vote

      favorite









      up vote
      0
      down vote

      favorite











      I am trying to convert an Excel macro that currently uses Internet Explorer and use the following line of code to extract the web page’s <body> text



      x = .Document.DocumentElement.InnerText


      Using the Selenium demo, I am able to produce a jpg of the page with Chrome & IE, but Firefox just loads a blank page and IE64 & Edge don’t work on Windows 10.



      I have been unable to find the proper VBA command with Selenium to copy the body text to variable ”x”. I only want to read it.



      I am trying to do this to make my macro browser independent.



      The macro is for my use only.



      Jim










      share|improve this question









      New contributor




      Jim Dell is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.











      I am trying to convert an Excel macro that currently uses Internet Explorer and use the following line of code to extract the web page’s <body> text



      x = .Document.DocumentElement.InnerText


      Using the Selenium demo, I am able to produce a jpg of the page with Chrome & IE, but Firefox just loads a blank page and IE64 & Edge don’t work on Windows 10.



      I have been unable to find the proper VBA command with Selenium to copy the body text to variable ”x”. I only want to read it.



      I am trying to do this to make my macro browser independent.



      The macro is for my use only.



      Jim







      excel vba excel-vba selenium






      share|improve this question









      New contributor




      Jim Dell is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.











      share|improve this question









      New contributor




      Jim Dell is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.









      share|improve this question




      share|improve this question








      edited Nov 7 at 7:44









      Pᴇʜ

      18.3k42549




      18.3k42549






      New contributor




      Jim Dell is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.









      asked Nov 7 at 2:46









      Jim Dell

      31




      31




      New contributor




      Jim Dell is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.





      New contributor





      Jim Dell is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.






      Jim Dell is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.
























          1 Answer
          1






          active

          oldest

          votes

















          up vote
          0
          down vote



          accepted










          You are not making it browser agnostic. You are simply widening the choice of browser to those supported via selenium basic. This brings some problems of its own which you are noticing.




          1. Folders containing the drivers must be on the environmental path or the path passed to selenium webdriver as an argument.

          2. You should use the latest Chrome browser and Chrome driver

          3. You cannot use the latest FireFox browser and driver. It is not supported. I think you need FF v.46.0.1.

          4. If using IE then zoom must be to 100%.

          5. I suggest browsing the issues pages of Github for further known issues

          6. Heuristically, I have heard some banter about problems with Windows 10 and Selenium Basic - would be interested to know if anyone has got this working as I am not on that version.


          Review the examples.xlsm provided by selenium basic GitHub site to see which other browsers are supported (e.g. Opera, PhantomJS, FirefoxLight,CEF).



          With Chrome you can get the body text with this:



          Option Explicit 
          Public Sub GetInfo()
          Dim d As WebDriver, s As String
          Set d = New ChromeDriver
          Const URL = "https://www.neutrinoapi.com/api/api-examples/python/"

          With d
          .Start "Chrome"
          .get URL
          s = .FindElementByTag("body").Text
          Debug.Print s
          .Quit
          End With
          End Sub




          Other info: https://stackoverflow.com/a/52294259/6241235






          share|improve this answer























          • Thanks I will give it a try
            – Jim Dell
            Nov 7 at 12:58










          • Yes it worked fine. Thanks for asking
            – Jim Dell
            yesterday













          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',
          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
          });


          }
          });






          Jim Dell is a new contributor. Be nice, and check out our Code of Conduct.










           

          draft saved


          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53182944%2faccess-web-page-body-text-using-vba-selenium%23new-answer', 'question_page');
          }
          );

          Post as a guest
































          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          up vote
          0
          down vote



          accepted










          You are not making it browser agnostic. You are simply widening the choice of browser to those supported via selenium basic. This brings some problems of its own which you are noticing.




          1. Folders containing the drivers must be on the environmental path or the path passed to selenium webdriver as an argument.

          2. You should use the latest Chrome browser and Chrome driver

          3. You cannot use the latest FireFox browser and driver. It is not supported. I think you need FF v.46.0.1.

          4. If using IE then zoom must be to 100%.

          5. I suggest browsing the issues pages of Github for further known issues

          6. Heuristically, I have heard some banter about problems with Windows 10 and Selenium Basic - would be interested to know if anyone has got this working as I am not on that version.


          Review the examples.xlsm provided by selenium basic GitHub site to see which other browsers are supported (e.g. Opera, PhantomJS, FirefoxLight,CEF).



          With Chrome you can get the body text with this:



          Option Explicit 
          Public Sub GetInfo()
          Dim d As WebDriver, s As String
          Set d = New ChromeDriver
          Const URL = "https://www.neutrinoapi.com/api/api-examples/python/"

          With d
          .Start "Chrome"
          .get URL
          s = .FindElementByTag("body").Text
          Debug.Print s
          .Quit
          End With
          End Sub




          Other info: https://stackoverflow.com/a/52294259/6241235






          share|improve this answer























          • Thanks I will give it a try
            – Jim Dell
            Nov 7 at 12:58










          • Yes it worked fine. Thanks for asking
            – Jim Dell
            yesterday

















          up vote
          0
          down vote



          accepted










          You are not making it browser agnostic. You are simply widening the choice of browser to those supported via selenium basic. This brings some problems of its own which you are noticing.




          1. Folders containing the drivers must be on the environmental path or the path passed to selenium webdriver as an argument.

          2. You should use the latest Chrome browser and Chrome driver

          3. You cannot use the latest FireFox browser and driver. It is not supported. I think you need FF v.46.0.1.

          4. If using IE then zoom must be to 100%.

          5. I suggest browsing the issues pages of Github for further known issues

          6. Heuristically, I have heard some banter about problems with Windows 10 and Selenium Basic - would be interested to know if anyone has got this working as I am not on that version.


          Review the examples.xlsm provided by selenium basic GitHub site to see which other browsers are supported (e.g. Opera, PhantomJS, FirefoxLight,CEF).



          With Chrome you can get the body text with this:



          Option Explicit 
          Public Sub GetInfo()
          Dim d As WebDriver, s As String
          Set d = New ChromeDriver
          Const URL = "https://www.neutrinoapi.com/api/api-examples/python/"

          With d
          .Start "Chrome"
          .get URL
          s = .FindElementByTag("body").Text
          Debug.Print s
          .Quit
          End With
          End Sub




          Other info: https://stackoverflow.com/a/52294259/6241235






          share|improve this answer























          • Thanks I will give it a try
            – Jim Dell
            Nov 7 at 12:58










          • Yes it worked fine. Thanks for asking
            – Jim Dell
            yesterday















          up vote
          0
          down vote



          accepted







          up vote
          0
          down vote



          accepted






          You are not making it browser agnostic. You are simply widening the choice of browser to those supported via selenium basic. This brings some problems of its own which you are noticing.




          1. Folders containing the drivers must be on the environmental path or the path passed to selenium webdriver as an argument.

          2. You should use the latest Chrome browser and Chrome driver

          3. You cannot use the latest FireFox browser and driver. It is not supported. I think you need FF v.46.0.1.

          4. If using IE then zoom must be to 100%.

          5. I suggest browsing the issues pages of Github for further known issues

          6. Heuristically, I have heard some banter about problems with Windows 10 and Selenium Basic - would be interested to know if anyone has got this working as I am not on that version.


          Review the examples.xlsm provided by selenium basic GitHub site to see which other browsers are supported (e.g. Opera, PhantomJS, FirefoxLight,CEF).



          With Chrome you can get the body text with this:



          Option Explicit 
          Public Sub GetInfo()
          Dim d As WebDriver, s As String
          Set d = New ChromeDriver
          Const URL = "https://www.neutrinoapi.com/api/api-examples/python/"

          With d
          .Start "Chrome"
          .get URL
          s = .FindElementByTag("body").Text
          Debug.Print s
          .Quit
          End With
          End Sub




          Other info: https://stackoverflow.com/a/52294259/6241235






          share|improve this answer














          You are not making it browser agnostic. You are simply widening the choice of browser to those supported via selenium basic. This brings some problems of its own which you are noticing.




          1. Folders containing the drivers must be on the environmental path or the path passed to selenium webdriver as an argument.

          2. You should use the latest Chrome browser and Chrome driver

          3. You cannot use the latest FireFox browser and driver. It is not supported. I think you need FF v.46.0.1.

          4. If using IE then zoom must be to 100%.

          5. I suggest browsing the issues pages of Github for further known issues

          6. Heuristically, I have heard some banter about problems with Windows 10 and Selenium Basic - would be interested to know if anyone has got this working as I am not on that version.


          Review the examples.xlsm provided by selenium basic GitHub site to see which other browsers are supported (e.g. Opera, PhantomJS, FirefoxLight,CEF).



          With Chrome you can get the body text with this:



          Option Explicit 
          Public Sub GetInfo()
          Dim d As WebDriver, s As String
          Set d = New ChromeDriver
          Const URL = "https://www.neutrinoapi.com/api/api-examples/python/"

          With d
          .Start "Chrome"
          .get URL
          s = .FindElementByTag("body").Text
          Debug.Print s
          .Quit
          End With
          End Sub




          Other info: https://stackoverflow.com/a/52294259/6241235







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Nov 7 at 10:32

























          answered Nov 7 at 7:38









          QHarr

          24.9k81839




          24.9k81839












          • Thanks I will give it a try
            – Jim Dell
            Nov 7 at 12:58










          • Yes it worked fine. Thanks for asking
            – Jim Dell
            yesterday




















          • Thanks I will give it a try
            – Jim Dell
            Nov 7 at 12:58










          • Yes it worked fine. Thanks for asking
            – Jim Dell
            yesterday


















          Thanks I will give it a try
          – Jim Dell
          Nov 7 at 12:58




          Thanks I will give it a try
          – Jim Dell
          Nov 7 at 12:58












          Yes it worked fine. Thanks for asking
          – Jim Dell
          yesterday






          Yes it worked fine. Thanks for asking
          – Jim Dell
          yesterday












          Jim Dell is a new contributor. Be nice, and check out our Code of Conduct.










           

          draft saved


          draft discarded


















          Jim Dell is a new contributor. Be nice, and check out our Code of Conduct.













          Jim Dell is a new contributor. Be nice, and check out our Code of Conduct.












          Jim Dell is a new contributor. Be nice, and check out our Code of Conduct.















           


          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53182944%2faccess-web-page-body-text-using-vba-selenium%23new-answer', 'question_page');
          }
          );

          Post as a guest




















































































          Popular posts from this blog

          横浜市

          Rostock

          Europa