none
Problem with getElementsByClassName at my friend's Class {mshtml.dll file diffrent somehow) RRS feed

  • Question

  • I created a PowerShell automation script and I gave it to my friend when he run it, it said

    <pre>Method invocation failed because [mshtml.HTMLBodyClass] does not contain a method
    named 'getElementsByClassName'.
    At C:\Users\עמית\Documents\asaf.ps1:22 char:3
    +   $a=$docs.body.getElementsByClassName("FadeOut-Scroll")
        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
        + FullyQualifiedErrorId : MethodNotFound</pre>

    why is that happened?

    We both have IE11, .net 4.5, Visual studio, but I have that function and he not.

    And it looks like here in his computer the IE console have the function:



    but PowerShell does not:



    How to update PowerShell?

    an answer i got 

    "That's a question only Microsoft can answer"




    • Edited by asafgb Saturday, January 23, 2016 8:57 PM
    Saturday, January 23, 2016 8:56 PM

Answers

  • document.getElementsByClassName

    document.body is an element. document is a DOM object.

    document.documentMode will return the documentMode that IE is using.

    IE8 documentModes and less do not support getElementsByClassName.

    Your friend probably has the unnamed website in their compatibility view list or the domain network is configured to use Compatibility mode for intranet sites. Confirm this by using the Dev tool console (document.documentMode) or Emulation tab to determine which documentMode their UA is using.

    Post questions about html, css and scripting for website development to

    https://social.msdn.microsoft.com/Forums/ie/en-US/home?forum=iewebdevelopment&prof=required

    If possible include with your questions a link to your website or a mashup.

    Regards.

    Questions regarding Internet Explorer 8, 9 and 10 and Internet Explorer 11 for the IT Pro Audience. Topics covered are: Installation, Deployment, Configuration, Security, Group Policy, Management questions. If you are a consumer looking for answers or to raise a question, it's highly recommended you head on over to http://answers.microsoft.com/en-us. If possible include with your question links to any websites that you are having problems with.


    Rob^_^

    Sunday, January 24, 2016 11:36 PM

All replies

  • document.getElementsByClassName

    document.body is an element. document is a DOM object.

    document.documentMode will return the documentMode that IE is using.

    IE8 documentModes and less do not support getElementsByClassName.

    Your friend probably has the unnamed website in their compatibility view list or the domain network is configured to use Compatibility mode for intranet sites. Confirm this by using the Dev tool console (document.documentMode) or Emulation tab to determine which documentMode their UA is using.

    Post questions about html, css and scripting for website development to

    https://social.msdn.microsoft.com/Forums/ie/en-US/home?forum=iewebdevelopment&prof=required

    If possible include with your questions a link to your website or a mashup.

    Regards.

    Questions regarding Internet Explorer 8, 9 and 10 and Internet Explorer 11 for the IT Pro Audience. Topics covered are: Installation, Deployment, Configuration, Security, Group Policy, Management questions. If you are a consumer looking for answers or to raise a question, it's highly recommended you head on over to http://answers.microsoft.com/en-us. If possible include with your question links to any websites that you are having problems with.


    Rob^_^

    Sunday, January 24, 2016 11:36 PM
  • How to update PowerShell?

    In which OS?  W10 users would already have  PSversion 5.0

    Try entering  $PSVersionTable  to see what you have.

    https://technet.microsoft.com/en-us/library/hh857339.aspx?f=255&MSPPError=-2147217396

    (Microsoft search for
        PowerShell version 5.0
    )

    Note the caveat

    <quote>
    Be sure to read the download details, and meet all system requirements, before
    you install Windows Management Framework 5.0 Preview.

    </quote>



    Robert Aldwinckle
    ---

    Tuesday, January 26, 2016 1:31 AM
    Answerer
  • Hi,
    Would you mind letting me know the result of the suggestions? If you need further assistance, feel free to let me know. I will be more than happy to be of assistance.


    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact tnmff@microsoft.com.

    Monday, February 1, 2016 9:48 AM
    Moderator