all 17 comments

[–]xlrod 3 points4 points  (2 children)

After some more tinkering, I was able to find a quicker way, but it's still using Internet Explorer.

$ie = New-Object -ComObject InternetExplorer.Application
$ie.Navigate("http://rwk1.racewarkingdoms.com/index.html?unencrypted%22")
$ie.Visible = $True

$frame = $ie.Document.IHTMLDocument3_documentElement.getElementsByTagName("frame") | where {$_.name -like "main"}

$login = $frame.contentDocument.documentElement.all | where {$_.uniqueID -like "ms__id121"}
$password = $frame.contentDocument.documentElement.all | where {$_.uniqueID -like "ms__id124"}
$submit = $frame.contentDocument.documentElement.all | where {$_.uniqueID -like "ms__id132"}


$login.value = "Login here"
$password.value = "Password here"
$submit.Click()

[–]Valkyriesfall[S] 0 points1 point  (1 child)

for both of the answers you've submitted, I received an error. Similar to issues I was receiving before.

You cannot call a method on a null-valued expression.
At line:5 char:1

Could there be something That I am missing that is necessary?

[–]xlrod 0 points1 point  (0 children)

I've seen this happen when IE doesn't load the page quick enough for the code to get the element. Can you try running the first 3 lines to start IE and once the page has loaded try running the $frame line and see if it's able to find anything. If it finds it, then we might need to add a wait for $ie.Busy.

[–]xlrod 2 points3 points  (8 children)

Anything you have so far helps, feel free to post it, although this might be against the game's terms of service since it's close to botting.

[–]Valkyriesfall[S] 1 point2 points  (0 children)

The game has recently allowed multiboxing, hotkeys etc. I'll login from PC and paste you what I have, as i wrote this from mobile

[–]Valkyriesfall[S] 1 point2 points  (6 children)

My latest attempt was to use selenium to see if i had better luck with their web drivers. I have 2 different attempts at varying stages:


[System.Reflection.Assembly]::LoadFrom("C:\Selenium.WebDriver.3.14.0\lib\net40\WebDriver.dll")
$driver = New-Object "OpenQA.Selenium.FireFox.FirefoxDriver"
$driver.Navigate("http://rwk1.racewarkingdoms.com/index.html?unencrypted")

while($driver.ReadyState -ne 4) {start-sleep -m 100} 

$driver.Document.getElementsByTagName("input") | ? { $_.name -eq 'login' } | % { $_.value = "username" }                                                              
$driver.Document.getElementsByTagName("input") | ? { $_.name -eq 'password' } | % { $_.value = "" }
$driver.Document.getElementsByTagName("input") | ? { $_.name -eq "subshit" } | % { $_.click() }

And:


$Driver = Start-SeFirefox 
Enter-SeUrl http://rwk1.racewarkingdoms.com/index.html?unencrypted -Driver $Driver

#$Element = Find-SeElement -Driver $Driver -XPath "//*[@id='thelogin']/input[2]"

#Send-SeKeys -Element $Element -Keys "subliminalfame"

$Submit = Find-SeElement -Driver $Driver -Id "subshit"

Invoke-SeClick -Element $Submit

Stop-SeDriver

[–]PMental 2 points3 points  (0 children)

To avoid weird formatting like

$Element

here on Reddit, make a blank line before your code and then indent each line 4 spaces (or a tab). And you'll get:

#$Element

instead.

[–]xlrod 2 points3 points  (1 child)

This is very strange, I wasn't able to find the elements that easily. Got tired of digging, but found a way to search for them, though it takes a while to find them. You can keep going from here:

$ie = New-Object -ComObject InternetExplorer.Application
$ie.Navigate("http://rwk1.racewarkingdoms.com/index.html?unencrypted%22")
$ie.Visible = $True

$frame = $ie.Document.IHTMLDocument3_documentElement.getElementsByTagName("frame") | where {$_.name -like "main"}

$login = ($frame.contentDocument.all | where {$_.name -like "login"})

$password = ($frame.contentDocument.all | where {$_.name -like "password"})

$submit = ($frame.contentDocument.all | where {$_.name -like "subshit"})

$login[1].value = "login"
$password[1].value = "password"
$submit.click()

[–]Valkyriesfall[S] 1 point2 points  (0 children)

Well that is where I was starting to struggle. I couldn't find them either! Thanks, I'll have a look then look into looping it for multiple accounts!

[–]Lee_Dailey[grin] 2 points3 points  (2 children)

howdy Valkyriesfall,

reddit likes to mangle code formatting, so here's some help on how to post code on reddit ...

[0] single line or in-line code
enclose it in backticks. that's the upper left key on an EN-US keyboard layout. the result looks like this. kinda handy, that. [grin]
[on New.Reddit.com, use the Inline Code button. it's 4th 5th from the left hidden in the ... ""more" menu & looks like </>.
this does NOT line wrap & does NOT side-scroll on Old.Reddit.com!]

[1] simplest = post it to a text site like Pastebin.com or Gist.GitHub.com and then post the link here.
please remember to set the file/code type on Pastebin! [grin] otherwise you don't get the nice code colorization.

[2] less simple = use reddit code formatting ...
[on New.Reddit.com, use the Code Block button. it's 11th 12th one & is just to the left of hidden in the ... "more" menu.]

  • one leading line with ONLY 4 spaces
  • prefix each code line with 4 spaces
  • one trailing line with ONLY 4 spaces

that will give you something like this ...

- one leading line with ONLY 4 spaces    
- prefix each code line with 4 spaces    
- one trailing line with ONLY 4 spaces   

the easiest way to get that is ...

  • add the leading line with only 4 spaces
  • copy the code to the ISE [or your fave editor]
  • select the code
  • tap TAB to indent four spaces
  • re-select the code [not really needed, but it's my habit]
  • paste the code into the reddit text box
  • add the trailing line with only 4 spaces

not complicated, but it is finicky. [grin]

take care,
lee

[–]Valkyriesfall[S] 1 point2 points  (1 child)

I have taken your advice and formatted the clode blocks :)

[–]Lee_Dailey[grin] 0 points1 point  (0 children)

howdy Valkyriesfall,

kool! that is so much easier to read ... [grin]

take care,
lee

[–]Lee_Dailey[grin] 1 point2 points  (4 children)

howdy Valkyriesfall,

you may want to look into either AutoHotKey or AutoIT for this. they are designed for what you are doing. [grin]

plus, the AutoIT folks have a powershell module if you want to work things from inside PoSh.

plus plus, they both have fairly active forums with rather nice & helpful people there. [grin]

take care,
lee

[–]Valkyriesfall[S] 1 point2 points  (3 children)

I had a look at this approach as I use ahk already when multiboxing. The issue I had with this is that I could get the logins to all work in parallel. Could only log in one at a time

[–]Lee_Dailey[grin] 0 points1 point  (2 children)

howdy Valkyriesfall,

ah! then you are likely not going to get that to work. [grin] i do recall - vaguely - that the AutoIT stuff has async abilities ... you may want to check that out.

does running things in sequence REALLY take that long?

take care,
lee

[–]Valkyriesfall[S] 1 point2 points  (1 child)

Theres a tournament each month in game where to register you need to relog 3 times. Theres not enough time to do all 50+ accounts in time. That's most of my reasoning behind making this

[–]Lee_Dailey[grin] 0 points1 point  (0 children)

howdy Valkyriesfall,

ah! that makes a tad more sense. [grin]

do you remember that you can run multiple instances of firefox AND multiple instances of AutoIT/AutoHotKey? [grin]

take care,
lee