Jump to content

Recommended Posts

Posted (edited)

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
Posted
#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.

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
  • Recently Browsing   0 members

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