Clerythecleric Posted April 23, 2018 Share Posted April 23, 2018 (edited) Hello, I have used the FF.Au3 quite alot in the past and never had much issues until now. Though I'm doing something with it I haven't done before. So I'm trying to change the style of a button used on a internet page (Its a work page ran behind VPN with authentication. so i cannot share the page itself, as it wouldn't open for you). Seems Fairly simple. I can manually do this by looking at the html and changing this: "<button type="submit" value="Investigate" id="investigateBatch" localizer-text="GSR_Investigate_Batch_Button">Investigate Batch</button>" To this: "<button type="submit" value="Investigate" id="investigateBatch" localizer-text="GSR_Investigate_Batch_Button" style="float: right; color: red; margin-right: 120px;" >Investigate Batch</button>" Works perfect when done like this. But my issue is with Autoit. I tried using methods mentioned on this forum which involve Grabbing the entire page, searching the string and making the change, to then writing the HTML back to the page. Basically i had many many issues along the way, but found a way to make it work although now the button itself no longer works. The page is all messed up and won't load further ones. This page uses alot of javascript and other scripts to generate the content as it loads. I have even tried just downloading the entire html page, saving to a text file. Then manually copy and pasting this onto the html of the same page. With 0 changes, and this also breaks the button. So it seems i cannot re-write the entire html or just the <body> otherwise it breaks. I would ideally like to just edit the button HTML itself, and not have to re-write the whole page. Is this possible to do pleasE? Here is what i have so far: expandcollapse popup#include <FF.au3> #include <Array.au3> Opt("GUIOnEventMode", 1) HotKeySet("{ESC}", "On_Exit") HotKeySet("{F1}", "start") while 1 sleep(50) WEnd func Start() If _FFConnect(Default, default, 3000) Then ; MsgBox("", "Connected to FF", "Connected to FFted", "conencted") ToolTip("Connected") sleep(200) ToolTip("") Else MsgBox(64, "", "Cannot Connect" & @LF & "Ensure Moz Repl Extention is installed" & @lf & "Ensure Moz Repl is started (Alt + T) then restart" ) Exit EndIf $sHTML = _FFReadHTML("body") FileWrite("test.txt", $sHTML) ;$a = StringInStr($sHTML,'<button type="submit" value="Investigate" id="investigateBatch" localizer-text="GSR_Investigate_Batch_Button">Investigate Batch</button>') ;$b = StringReplace($sHTML,$a,'<button type="submit" value="Investigate" id="investigateBatch" localizer-text="GSR_Investigate_Batch_Button" style="float: right; color: red; margin-right: 120px;" >Investigate Batch</button>') ;Local $replacedVersion = StringReplace ($b, @CR, "") ;$replacedVersion = StringReplace ($replacedVersion, @LF, "") ;$replacedVersion = StringReplace ($replacedVersion, @TAB, "") ;$replacedVersion = StringReplace ($replacedVersion, "'", "''") ;_FFWriteHTML($replacedVersion, "body") EndFunc func On_Exit() Exit EndFunc Edited April 23, 2018 by Clerythecleric Link to comment Share on other sites More sharing options...
Danp2 Posted April 23, 2018 Share Posted April 23, 2018 Have you tried using _FFCmd, something like this? _FFXPath("//button[@id='investigateBatch']") _FFCmd("FFau3.xpath.style='your new style settings go here'") Clerythecleric 1 Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
Clerythecleric Posted April 23, 2018 Author Share Posted April 23, 2018 O.M.G That is perfect, and simple, and very fast. Thank you very much sir =). You may of secured my promotion. 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