AlienStar Posted May 7, 2018 Share Posted May 7, 2018 (edited) hello everybody I have this code in my html <div class="tagsdiv" id="post_tag"> <div class="jaxtag"> <div class="nojs-tags hide-if-js"> <label for="tax-input-post_tag">Add, Remove Tags</label> <p><textarea name="tax_input[post_tag]" rows="3" cols="20" class="the-tags" id="tax-input-post_tag" aria-describedby="new-tag-post_tag-desc"></textarea></p> </div> <div class="ajaxtag hide-if-no-js"> <label class="screen-reader-text" for="new-tag-post_tag">Add New Tag</label> <p><input data-wp-taxonomy="post_tag" type="text" id="new-tag-post_tag" name="newtag[post_tag]" class="newtag form-input-tip" size="16" autocomplete="off" aria-describedby="new-tag-post_tag-desc" value="" /> <input type="button" class="button tagadd" value="Add" /></p> </div> <p class="howto" id="new-tag-post_tag-desc">Split tags with comma</p> </div> <ul class="tagchecklist" role="list"></ul> </div> I wanna set tag in its text area but I can't here is my code #include <IE.au3> #include <array.au3> #Include <File.au3> #include <MsgBoxConstants.au3> Local $oIE =_IECreate($url) Local $oTag = _IEGetObjById($oIE,"new-tag-post_tag") _IEFormElementSetValue($oTag, "cars") please help Edited May 7, 2018 by AlienStar Link to comment Share on other sites More sharing options...
Danp2 Posted May 7, 2018 Share Posted May 7, 2018 You haven't told us what isn't working as expected. Run your code in Scite and post the contents of the Output panel. Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
AlienStar Posted May 7, 2018 Author Share Posted May 7, 2018 (edited) what output I have to get if I have an element I wanna set its value, not get a value ? Edited May 7, 2018 by AlienStar Link to comment Share on other sites More sharing options...
AlienStar Posted May 7, 2018 Author Share Posted May 7, 2018 (edited) the HTML code I've posted is from the dashboard of wordpress. I make an automatic post publishing but I need to set tags for the post before publishing Edited May 7, 2018 by AlienStar Link to comment Share on other sites More sharing options...
Danp2 Posted May 7, 2018 Share Posted May 7, 2018 I understand that you want to set the value of the input field. But you haven't provided enough information for us to help you. As requested previously, please run your code in Scite and post the contents of the Output panel. Also, provide the URL of the site if possible. Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
AlienStar Posted May 7, 2018 Author Share Posted May 7, 2018 there is no output or errors ! when I run the code it opens the page to post and do nothing for tags textarea ! I set the topic title by this : Local $title = _IEGetObjById($oIE, "title") Local $ttlcntnt = FileReadLine($files[$i], 1) _IEFormElementSetValue($title, $ttlcntnt) and it works well here is the part of html code which I depend on. <div id="titlewrap"> <label class="screen-reader-text" id="title-prompt-text" for="title">write title here</label> <input type="text" name="post_title" size="30" value="" id="title" spellcheck="true" autocomplete="off" /> </div> but when I try to do for tags by the same way it failed Link to comment Share on other sites More sharing options...
Danp2 Posted May 7, 2018 Share Posted May 7, 2018 Sorry, but my crystal ball is currently in the shop. Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
AlienStar Posted May 7, 2018 Author Share Posted May 7, 2018 excuse me but really I don't know what output I have to send here is my full code expandcollapse popup#include <IE.au3> #include <array.au3> #Include <File.au3> #include <MsgBoxConstants.au3> local $files = _FileListToArrayRec(@ScriptDir, "*.txt", $FLTAR_FILES, $FLTAR_RECUR, $FLTAR_SORT) for $i = 1 to UBound($files)-1 ;post topic content via url bellow Local $content = FileRead($files[$i]) ;------------------------------------------------ Local $url = "https://engnajjar.wordpress.com/wp-admin/post-new.php?content="&_URIEncode($content) Local $oIE =_IECreate($url) ;------------------------------------------------ _IELoadWait($oIE) ;------------------------------------------------ Local $title = _IEGetObjById($oIE, "title") Local $ttlcntnt = FileReadLine($files[$i], 1) if StringLen($ttlcntnt)=0 Then $ttlcntnt = FileReadLine($files[$i], 2) EndIf _IEFormElementSetValue($title, $ttlcntnt) ;------------------------------------------------ ; here choose the category checkbox Local $chkbx = _IEGetObjById($oIE, "in-popular-category-5") _IEAction($chkbx, "click") ;------------------------------------------------ ;here I wanna set tags Local $oTag = _IEGetObjById($oIE,"new-tag-post_tag") _IEFormElementSetValue($oTag, "cars") ;------------------------------------------------ ; here is publish button Local $oSubmit = _IEGetObjById($oIE,"publish") _IEAction($oSubmit, "click") ;------------------------------------------------ _IELoadWait($oIE) ;------------------------------------------------ _IEQuit($oIE) ProcessClose("iexplore.exe") next all the code works but the tags not thats all I can send you Link to comment Share on other sites More sharing options...
Danp2 Posted May 7, 2018 Share Posted May 7, 2018 @AlienStar Do you see an "Add" button next to the Tags input element? If so, have you tried clicking it in your script? P.S. You can press the F8 key in Scite to toggle the display of the Output panel. I would expect to see something like the following when you run your script -- >"C:\Program Files (x86)\AutoIt3\SciTE\..\AutoIt3.exe" "C:\Program Files (x86)\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.au3" /run /prod /ErrorStdOut /in "C:\test5.au3" /UserParams +>16:19:15 Starting AutoIt3Wrapper v.17.224.935.0 SciTE v.3.7.3.0 Keyboard:00000409 OS:WIN_10/ CPU:X64 OS:X64 Environment(Language:0409) CodePage:0 utf8.auto.check:4 +> SciTEDir => C:\Program Files (x86)\AutoIt3\SciTE UserDir => C:\Users\Dan\AppData\Local\AutoIt v3\SciTE\AutoIt3Wrapper SCITE_USERHOME => C:\Users\Dan\AppData\Local\AutoIt v3\SciTE >Running AU3Check (3.3.14.5) from:C:\Program Files (x86)\AutoIt3 input:C:\test5.au3 +>16:19:15 AU3Check ended.rc:0 >Running:(3.3.14.5):C:\Program Files (x86)\AutoIt3\autoit3.exe "C:\test5.au3" --> Press Ctrl+Alt+Break to Restart or Ctrl+Break to Stop --> IE.au3 T3.0-2 Warning from function _IEGetObjById, $_IESTATUS_NoMatch (in-popular-category-5) --> IE.au3 T3.0-2 Error from function _IEAction(click), $_IESTATUS_InvalidDataType +>16:19:26 AutoIt3.exe ended.rc:0 +>16:19:26 AutoIt3Wrapper Finished. >Exit code: 0 Time: 11.09 Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
AlienStar Posted May 7, 2018 Author Share Posted May 7, 2018 >"C:\Program Files (x86)\AutoIt3\SciTE\..\AutoIt3.exe" "C:\Program Files (x86)\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.au3" /run /prod /ErrorStdOut /in "C:\wamp\www\Egypt\category\Upload\tmp\write wp post.au3" /UserParams +>00:48:39 Starting AutoIt3Wrapper v.15.729.1555.1 SciTE v.3.5.4.0 Keyboard:00000409 OS:WIN_81/ CPU:X64 OS:X64 Environment(Language:0409) +> SciTEDir => C:\Program Files (x86)\AutoIt3\SciTE UserDir => C:\Users\Mouhammad\AppData\Local\AutoIt v3\SciTE\AutoIt3Wrapper SCITE_USERHOME => C:\Users\Mouhammad\AppData\Local\AutoIt v3\SciTE >Running AU3Check (3.3.12.0) from:C:\Program Files (x86)\AutoIt3 input:C:\wamp\www\Egypt\category\Upload\tmp\write wp post.au3 +>00:48:39 AU3Check ended.rc:0 >Running:(3.3.12.0):C:\Program Files (x86)\AutoIt3\autoit3.exe "C:\wamp\www\Egypt\category\Upload\tmp\write wp post.au3" --> Press Ctrl+Alt+Break to Restart or Ctrl+Break to Stop +>00:48:48 AutoIt3.exe ended.rc:0 +>00:48:48 AutoIt3Wrapper Finished. >Exit code: 0 Time: 9.346 Link to comment Share on other sites More sharing options...
Danp2 Posted May 7, 2018 Share Posted May 7, 2018 Not sure that it would make any difference, but is there a reason you aren't running a more recent version of Autoit? Also, please answer my earlier question. 12 minutes ago, Danp2 said: Do you see an "Add" button next to the Tags input element? If so, have you tried clicking it in your script? Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
AlienStar Posted May 7, 2018 Author Share Posted May 7, 2018 (edited) 28 minutes ago, Danp2 said: @AlienStar Do you see an "Add" button next to the Tags input element? If so, have you tried clicking it in your script? yeah I see but can't because it has no ID Edited May 7, 2018 by AlienStar Link to comment Share on other sites More sharing options...
Danp2 Posted May 7, 2018 Share Posted May 7, 2018 Well, AFAIK it won't work without clicking the button. You can either -- Use _IETagNameGetCollection to retrieve all Input elements and then traverse the collection of elements until you find the desired one (lots of examples of this on the forum) Use IEbyXPATH to retrieve the desired element Come up with another solution on your own. AlienStar 1 Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
AlienStar Posted May 7, 2018 Author Share Posted May 7, 2018 10 minutes ago, Danp2 said: Well, AFAIK it won't work without clicking the button. You can either -- Use _IETagNameGetCollection to retrieve all Input elements and then traverse the collection of elements until you find the desired one (lots of examples of this on the forum) Use IEbyXPATH to retrieve the desired element Come up with another solution on your own. thanks my friend I'll try Link to comment Share on other sites More sharing options...
Danp2 Posted May 7, 2018 Share Posted May 7, 2018 Please report back on your progress. Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
AlienStar Posted May 7, 2018 Author Share Posted May 7, 2018 ok my friend Link to comment Share on other sites More sharing options...
AlienStar Posted May 8, 2018 Author Share Posted May 8, 2018 (edited) I don't know whats happens ! I re-test the first code I write and it succeed and I don't know why it didn't work at first #include <IE.au3> #include <array.au3> #Include <File.au3> #include <MsgBoxConstants.au3> Local $oIE =_IECreate($url) Local $oTag = _IEGetObjById($oIE,"new-tag-post_tag") _IEFormElementSetValue($oTag, "cars") thanks anyway for help Danp2 Edited May 8, 2018 by AlienStar 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