iwak Posted September 6, 2014 Share Posted September 6, 2014 (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 September 6, 2014 by iwak Link to comment Share on other sites More sharing options...
JohnOne Posted September 6, 2014 Share Posted September 6, 2014 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 More sharing options...
mikell Posted September 6, 2014 Share Posted September 6, 2014 Use this on the source code $html_txt = StringRegExpReplace($html_txt, '<div[^>]+display:none[^>]+>', "") For the rest JO told you all Link to comment Share on other sites More sharing options...
iwak Posted September 7, 2014 Author Share Posted September 7, 2014 #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 More sharing options...
JohnOne Posted September 7, 2014 Share Posted September 7, 2014 Elaborate. 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 More sharing options...
mikell Posted September 7, 2014 Share Posted September 7, 2014 $txt = FileRead(@ScriptDir & '\1.html') $txt2 = StringRegExpReplace($txt, '<div[^>]+display:none[^>]+>', "") FileWrite(@ScriptDir & '\2.html', $txt2) Working. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now