Jump to content

Deleting data from the source code of the page


iwak
 Share

Recommended Posts

Hello.

1. How to remove known text from the page source code in the tags?

For example:
 

<span Text </span>

or
 

<div 123 </div>

2. And how do I delete this link below from the source code of the page:
 

<div class="p" id="1234567890ABCDE" style="margin-bottom:20px; display:none">

-If in this part code has this text - "display: none" ?
 

In the Firefox or IE i can manually find the text/element and remove it from the page's source code, but i need learn how to do this automatically by autoit.

My browser is IE. Please help.

Edited by iwak
Link to comment
Share on other sites

I think you have to read the whole source _IEDocReadHTML delete the node StringRegExp maybe then write the html back _IEDocWriteHTML.

All the functions mentioned are in the help file and should be read up on and their examples studied.

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Link to comment
Share on other sites

#include <IE.au3>

Local $oIE, $oDivs, $sUrl = @ScriptDir & '\1.html'

$oIE = _IECreate($sUrl, 0, 0)
$oDivs = _IETagNameGetCollection($oIE, 'div')
For $oDiv In $oDivs
    If $oDiv.currentStyle.GetAttribute('display') == 'none' Then
        _IETagNameAllGetCollection($oDiv)
        ConsoleWrite('before del child: ' & @extended & @LF)
        While IsObj($oDiv.firstChild)
            $oDiv.removeChild($oDiv.firstChild)
        WEnd
        _IETagNameAllGetCollection($oDiv)
        ConsoleWrite('after del child: ' & @extended & @LF)
    EndIf
Next
_IEAction($oIE, 'visible')

 

Not working.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...