blackandwhite Posted December 27, 2015 Share Posted December 27, 2015 Hello everybody!need to join these codes into one:#include <IE.au3> $sLogin = 'login@mail.com' $sPass = 'password' $sUrl = "m.facebook.com" $oIE = _IECreate($sUrl) $hWnd = _IEPropertyGet($oIE, "hwnd") WinSetState($hWnd, "", @SW_MAXIMIZE) $oLogin = _IEGetObjByName($oIE, 'email') $oPass = _IEGetObjByName($oIE, 'pass') _IEFormElementSetValue($oLogin, $sLogin) _IEFormElementSetValue($oPass, $sPass) $oButton = _IEGetObjByName($oIE, 'login') _IEAction($oButton, 'click')_IEAttach("Facebook") _IENavigate($oIE, "https://m.facebook.com/groups/1/") ;1 $oPost3 = _IEGetObjByName($oIE, 'xc_message') _IEFormElementSetValue($oPost3, 'AaBbCcDDddEEEeee1234566777888899999000000') $oPost4 = _IEGetObjByName($oIE, 'view_post') _IEAction($oPost4, "click")_IEAttach("Facebook") _IENavigate($oIE, "https://m.facebook.com/groups/2/") ;2 $oPost5 = _IEGetObjByName($oIE, 'xc_message') _IEFormElementSetValue($oPost5, 'AaBbCcDDddEEEeee1234566777888899999000000') $oPost6 = _IEGetObjByName($oIE, 'view_post') _IEAction($oPost6, "click")#include <IE.au3> Global $oLinks, $oForm, $oIE, $sURL, $iFlag = 0 $oIE = _IEAttach("Facebook") If @error Then Exit 1 $oLinks = _IETagNameGetCollection($oIE, "a") If @error Then Exit 2 $iFlag = 0 For $oLink In $oLinks If StringInStr(_IEPropertyGet($oLink, "outertext"), "Logout") > 0 Then $iFlag = 1 _IEAction($oLink, "focus") _IEAction($oLink, "click") ExitLoop EndIf Next If Not $iFlag Then Exit 3all of these works properly if run it separately, but I can't join all together for working without errorsneed it for post news on my groupscan you help me pls Link to comment Share on other sites More sharing options...
Danp2 Posted December 27, 2015 Share Posted December 27, 2015 Next time, show us the combined code along with the errors that are occurring. Here's an untested version:expandcollapse popupinclude <IE.au3> Local $sLogin = 'login@mail.com' Local $sPass = 'password' Local $sUrl = "m.facebook.com" Local $oIE = _IECreate($sUrl) Local $hWnd = _IEPropertyGet($oIE, "hwnd") WinSetState($hWnd, "", @SW_MAXIMIZE) Login() Group1() Group2() Logout() Func Login() $oLogin = _IEGetObjByName($oIE, 'email') $oPass = _IEGetObjByName($oIE, 'pass') _IEFormElementSetValue($oLogin, $sLogin) _IEFormElementSetValue($oPass, $sPass) $oButton = _IEGetObjByName($oIE, 'login') _IEAction($oButton, 'click') EndFunc Func Group1() _IENavigate($oIE, "https://m.facebook.com/groups/1/") ;1 $oPost3 = _IEGetObjByName($oIE, 'xc_message') _IEFormElementSetValue($oPost3, 'AaBbCcDDddEEEeee1234566777888899999000000') $oPost4 = _IEGetObjByName($oIE, 'view_post') _IEAction($oPost4, "click") EndFunc Func Group2() _IENavigate($oIE, "https://m.facebook.com/groups/2/") ;2 $oPost5 = _IEGetObjByName($oIE, 'xc_message') _IEFormElementSetValue($oPost5, 'AaBbCcDDddEEEeee1234566777888899999000000') $oPost6 = _IEGetObjByName($oIE, 'view_post') _IEAction($oPost6, "click") EndFunc Func Logout() Local $oLinks, $oForm, $sURL, $iFlag = 0 $oLinks = _IETagNameGetCollection($oIE, "a") If @error Then Exit 1 $iFlag = 0 For $oLink In $oLinks If StringInStr(_IEPropertyGet($oLink, "outertext"), "Logout") > 0 Then $iFlag = 1 _IEAction($oLink, "focus") _IEAction($oLink, "click") ExitLoop EndIf Next If Not $iFlag Then Exit 2 EndFunc Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
blackandwhite Posted December 27, 2015 Author Share Posted December 27, 2015 (edited) getiing this error:"C:\Program Files\AutoIt3\Include\IE.au3" (272) : ==> The requested action with this object has failed.: $oObject.navigate($sUrl) $oObject^ ERRORusing latest stable version AutoIt v3.3.14.2if you want I can send you an account for testing Edited December 27, 2015 by blackandwhite mist Link to comment Share on other sites More sharing options...
Danp2 Posted December 27, 2015 Share Posted December 27, 2015 You could try adding a COM error handler: https://www.autoitscript.com/forum/topic/177783-example-proper-usage-ieau3-udf-with-autoit-v3314x/ Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
blackandwhite Posted December 27, 2015 Author Share Posted December 27, 2015 sorry, may be this is noob code, but its trying to navigate to GROUP_1 before before authorization on website, and there are no errors return for meexpandcollapse popup#include <IE.au3> #include <msgboxconstants.au3> Local $sLogin = 'login@mail.com' Local $sPass = 'password' Local $sUrl = "m.facebook.com" Login1() Func Login1() Global $oIE = _IECreate($sUrl) ;WinSetState($hWnd, "", @SW_MAXIMIZE) If @error Then MsgBox($MB_ICONERROR, '_IECreate', '@error = ' & @error & @CRLF & '@extended = ' & @extended) ; Set @error when you return from function with Failure Return SetError(1,0,0) Endif Local $hWnd = _IEPropertyGet($oIE, "hwnd") If @error Then MsgBox($MB_ICONERROR, '_IEPropertyGet', '@error = ' & @error & @CRLF & '@extended = ' & @extended) ; Set @error when you return from function with Failure Return SetError(2,0,0) Endif EndFunc Login() Group1() Func Login() $oLogin = _IEGetObjByName($oIE, 'email') If @error Then MsgBox($MB_ICONERROR, '_IEGetObjByName', '@error = ' & @error & @CRLF & '@extended = ' & @extended) ; Set @error when you return from function with Failure Return SetError(3,0,0) Endif $oPass = _IEGetObjByName($oIE, 'pass') If @error Then MsgBox($MB_ICONERROR, '_IEGetObjByName', '@error = ' & @error & @CRLF & '@extended = ' & @extended) ; Set @error when you return from function with Failure Return SetError(4,0,0) Endif _IEFormElementSetValue($oLogin, $sLogin) If @error Then MsgBox($MB_ICONERROR, '_IEFormElementSetValue', '@error = ' & @error & @CRLF & '@extended = ' & @extended) ; Set @error when you return from function with Failure Return SetError(5,0,0) Endif _IEFormElementSetValue($oPass, $sPass) If @error Then MsgBox($MB_ICONERROR, '_IEFormElementSetValue', '@error = ' & @error & @CRLF & '@extended = ' & @extended) ; Set @error when you return from function with Failure Return SetError(6,0,0) Endif $oButton = _IEGetObjByName($oIE, 'login') If @error Then MsgBox($MB_ICONERROR, '_IEGetObjByName', '@error = ' & @error & @CRLF & '@extended = ' & @extended) ; Set @error when you return from function with Failure Return SetError(7,0,0) Endif _IEAction($oButton, 'click') If @error Then MsgBox($MB_ICONERROR, '_IEAction', '@error = ' & @error & @CRLF & '@extended = ' & @extended) ; Set @error when you return from function with Failure Return SetError(8,0,0) Endif EndFunc Func Group1() _IENavigate($oIE, "https://m.facebook.com/groups1/") ;1 If @error Then MsgBox($MB_ICONERROR, '_IENavigate', '@error = ' & @error & @CRLF & '@extended = ' & @extended) ; Set @error when you return from function with Failure Return SetError(9,0,0) Endif $oPost3 = _IEGetObjByName($oIE, 'xc_message') If @error Then MsgBox($MB_ICONERROR, '_IEGetObjByName', '@error = ' & @error & @CRLF & '@extended = ' & @extended) ; Set @error when you return from function with Failure Return SetError(10,0,0) Endif _IEFormElementSetValue($oPost3, 'AaBbCcDDddEEEeee1234566777888899999000000') If @error Then MsgBox($MB_ICONERROR, '_IEFormElementSetValue', '@error = ' & @error & @CRLF & '@extended = ' & @extended) ; Set @error when you return from function with Failure Return SetError(11,0,0) Endif $oPost4 = _IEGetObjByName($oIE, 'view_post') If @error Then MsgBox($MB_ICONERROR, '_IEGetObjByName', '@error = ' & @error & @CRLF & '@extended = ' & @extended) ; Set @error when you return from function with Failure Return SetError(12,0,0) Endif _IEAction($oPost4, "click") If @error Then MsgBox($MB_ICONERROR, '_IEAction', '@error = ' & @error & @CRLF & '@extended = ' & @extended) ; Set @error when you return from function with Failure Return SetError(13,0,0) Endif EndFuncalso tried with this:While _IEPropertyGet($oIE, "busy") = True Sleep(50); wait while IE is busy WEndand;just Sleep(4000)or_IENavigate($oIE, "https://group_1") ;with different parameters _IELoadWait($oIE) ;with different parametersno luck, still navigating before login ends Link to comment Share on other sites More sharing options...
Danp2 Posted December 27, 2015 Share Posted December 27, 2015 Have you tried adding:_IELoadWait($oIE)after:_IEAction($oButton, 'click') Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
blackandwhite Posted December 27, 2015 Author Share Posted December 27, 2015 of course Link to comment Share on other sites More sharing options...
blackandwhite Posted December 27, 2015 Author Share Posted December 27, 2015 also checked with old Autoit versions, nooo luck still start navigating before login ends Link to comment Share on other sites More sharing options...
Danp2 Posted December 27, 2015 Share Posted December 27, 2015 Suggest that you post a highly simplified version of your script that demonstrates the issue. Also, be sure to include the version of OS, IE, AutoIT, etc. Latest Webdriver UDF Release Webdriver Wiki FAQs 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