none
Find a psecific string on a website and then innitiate mouse click on it RRS feed

  • Question

  • I'm trying to open a website where I only know the URL for the main page. So I have a script to open Internet Explorer and navigate to that website however after I would like the script to find a specific String "File". This string can be found twice. Once as "File" and once in the "Profile" word, so what I need is to find the exact String "File" and then click on it, it would open a javascript menu where again it should find another specific string "Incident..." and open the link behind it.

    Hope I was clear.

    The script I have will open the browser navigate to the website, but can not make it to find the keyword and initiate the click event, could you help me with that?

    I have the following code so far:

    Set ie = WScript.CreateObject("InternetExplorer.Application")
    
    ie.ToolBar = 1
    ie.StatusBar = 0
    ie.Width = 800
    ie.Height = 600
    ie.Visible = 1
    Do While ie.Busy: Loop
    ie.Navigate("https://site link")
    WScript.Sleep 1000
    
    For Each a In IE.Document.GetElementsByTagName("")
    If LCase(a.href = LCase("File")) Then
    a.Click
    Exit For  
    End If
    Next
    Wednesday, March 27, 2019 3:51 PM

Answers

  • You have no tagname defined.  You must use a tagname that is valid.


    \_(ツ)_/

    • Marked as answer by kocsism Wednesday, April 24, 2019 7:39 PM
    Wednesday, March 27, 2019 8:13 PM

All replies

  • You have no tagname defined.  You must use a tagname that is valid.


    \_(ツ)_/

    • Marked as answer by kocsism Wednesday, April 24, 2019 7:39 PM
    Wednesday, March 27, 2019 8:13 PM
  • Do you mean tags like that?

    <SCRIPT LANGUAGE="VBScript">

    </SCRIPT>

    or what do you mean by tagname exactly?


    Wednesday, March 27, 2019 9:44 PM
  • Tagname is the name that ide notifies the element like A,TABLE,INPUT, SPAN …

    Start here: https://www.w3schools.com/html/default.asp


    \_(ツ)_/

    Wednesday, March 27, 2019 10:16 PM
  • I know these html tags, but still do notunderstand how would thy help me with this .vbs file.
    Wednesday, March 27, 2019 10:26 PM
  • I know these html tags, but still do notunderstand how would thy help me with this .vbs file.

    Where did you get the VBS file?  To use it you have to use a tag name in the query.

    For Eacha InIE.Document.GetElementsByTagName("TABLE")


    \_(ツ)_/

    Wednesday, March 27, 2019 10:54 PM
  • but the issue is that the part where I have to look for a word is defined in a javascript file, this is in internal website available only from a specific domain, and basicly the whole webpage is being displayed based on the javascript files, so what I would need is that this script is not checking the tags but checking the webpage basicly and initiating the button click when the word "File" (Exactly this string has been found.
    Thursday, March 28, 2019 12:26 PM
  • You cannot access a javascript file that is external to the page.  It does not exist in the page but is called from the page.  It is only available in the GUI.


    \_(ツ)_/

    Thursday, March 28, 2019 12:44 PM
  • SO you say that there is no way of searching in the GUI like this? and if that's the case would you have any other idea how to approach this?
    Thursday, March 28, 2019 1:03 PM
  • SO you say that there is no way of searching in the GUI like this? and if that's the case would you have any other idea how to approach this?

    Without some idea of what you are trying to do there is no way to answer your question.


    \_(ツ)_/

    Thursday, March 28, 2019 3:18 PM