Danp2 Posted March 26, 2014 Posted March 26, 2014 It depends on where you placed this command within the existing code. If you place it after the line ConsoleWrite('Followers = ' & $oLink.innerText & @CRLF) then $oLink should still be pointing to the correct link and the MsgBox will display the desired output. If you place it at the bottom of the other code, then $oLink will no longer be referencing the desired link and your results will be off. Latest Webdriver UDF Release Webdriver Wiki FAQs
Arclite86 Posted March 26, 2014 Author Posted March 26, 2014 It depends on where you placed this command within the existing code. If you place it after the line ConsoleWrite('Followers = ' & $oLink.innerText & @CRLF) then $oLink should still be pointing to the correct link and the MsgBox will display the desired output. If you place it at the bottom of the other code, then $oLink will no longer be referencing the desired link and your results will be off. thank you it worked
Arclite86 Posted March 27, 2014 Author Posted March 27, 2014 (edited) now i have got a strange problem, when i try it with an other twitter user ( different numbers) it keeps giving te number 989 every time even when the number is 1005 in reality and when i try it without opening a IE tab it still give's the same number, it looks like it saves the results from the first time and shows it every time im running it, how is that possible? #include <IE.au3> $oIe = _IEAttach("Twitter") If @error = $_IEStatus_NoMatch Then ConsoleWrite("tab niet gevonden" & @CRLF) Exit EndIf $oLinks = _IELinkGetCollection($oIe) For $oLink In $oLinks If $oLink.className = 'js-nav' Then If $oLink.getAttribute('data-nav') = 'followers' Then ConsoleWrite('Followers = ' & $oLink.innerText & @CRLF) MsgBox (0,"message",":"&$oLink.innerText) EndIf EndIf Next $oLinks2 = _IELinkGetCollection($oIe) For $oLink2 In $oLinks2 If $oLink2.className = 'js-nav' Then If $oLink2.getAttribute('data-nav') = 'following' Then ConsoleWrite('following = ' & $oLink2.innerText & @CRLF) MsgBox (0,"message",":"&$oLink2.innerText) EndIf EndIf Next this is what i get when i run it : >"C:\Program Files (x86)\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.exe" /run /prod /ErrorStdOut /in "C:\teller2.au3" /UserParams +>16:47:35 Starting AutoIt3Wrapper v.2.1.4.4 SciTE v.3.3.7.0 ; Keyboard:00020409 OS:WIN_81/ CPU:X64 OS:X64 Environment(Language:0413 Keyboard:00020409 OS:WIN_81/ CPU:X64 OS:X64) >Running AU3Check (3.3.10.2) from:C:\Program Files (x86)\AutoIt3 +>16:47:35 AU3Check ended.rc:0 >Running:(3.3.10.2):C:\teller2.au3" --> Press Ctrl+Alt+F5 to Restart or Ctrl+Break to Stop Followers = 989 following = 1.362 +>16:47:37 AutoIt3.exe ended.rc:0 +>16:47:37 AutoIt3Wrapper Finished.. >Exit code: 0 Time: 3.044 it give's result even when I dont have internet connection so there is no way it could track it from a website Edited March 27, 2014 by Arclite86
Solution Danp2 Posted March 27, 2014 Solution Posted March 27, 2014 Perhaps the _IEAttach is finding another instance of IE that is open to Twitter? <shrug> Try changing your script to utilize _IECreate / _IENavigate so that you are sure that you have accessed the correct web page. Also, there's no need to call _IELinkGetCollection twice and loop through the results multiple times. Just move your conditional checks within the same loop, like this: $oLinks = _IELinkGetCollection($oIe) For $oLink In $oLinks If $oLink.className = 'js-nav' Then If $oLink.getAttribute('data-nav') = 'followers' Then ConsoleWrite('Followers = ' & $oLink.innerText & @CRLF) MsgBox (0,"Followers",":"&$oLink.innerText) EndIf If $oLink.getAttribute('data-nav') = 'following' Then ConsoleWrite('following = ' & $oLink.innerText & @CRLF) MsgBox (0,"Following",":"&$oLink.innerText) EndIf EndIf Next Latest Webdriver UDF Release Webdriver Wiki FAQs
Arclite86 Posted March 27, 2014 Author Posted March 27, 2014 Perhaps the _IEAttach is finding another instance of IE that is open to Twitter? <shrug> Try changing your script to utilize _IECreate / _IENavigate so that you are sure that you have accessed the correct web page. Also, there's no need to call _IELinkGetCollection twice and loop through the results multiple times. Just move your conditional checks within the same loop, like this: $oLinks = _IELinkGetCollection($oIe) For $oLink In $oLinks If $oLink.className = 'js-nav' Then If $oLink.getAttribute('data-nav') = 'followers' Then ConsoleWrite('Followers = ' & $oLink.innerText & @CRLF) MsgBox (0,"Followers",":"&$oLink.innerText) EndIf If $oLink.getAttribute('data-nav') = 'following' Then ConsoleWrite('following = ' & $oLink.innerText & @CRLF) MsgBox (0,"Following",":"&$oLink.innerText) EndIf EndIf Next thank you I used _IENavigate($oIE, "https://website.com") and it worked
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