iwak 0 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 Share this post Link to post Share on other sites
JohnOne 1,603 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. Share this post Link to post Share on other sites
mikell 1,007 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 Share this post Link to post Share on other sites
iwak 0 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. Share this post Link to post Share on other sites
JohnOne 1,603 Posted September 7, 2014 Elaborate. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Share this post Link to post Share on other sites
mikell 1,007 Posted September 7, 2014 $txt = FileRead(@ScriptDir & '\1.html') $txt2 = StringRegExpReplace($txt, '<div[^>]+display:none[^>]+>', "") FileWrite(@ScriptDir & '\2.html', $txt2) Working. Share this post Link to post Share on other sites