C# - Clicking on buttons via JavaScript -


i had following situation , problem c# didn't found real solution online.

a program should click on button on particular page. can done in 2 different ways. page includes external javascript want execute. clicking button not via [element].invokemember("click") executing via [webbrowser].invokescript([...])

but isn't working.

i couldn't determine whether opens window (cause browser unvisible in background).

so: ask - there way determine or doing wrong d:?

any appreciated. thank =)!

my method execute javascript (browser system.windows.controls object) - should buy item in steamcommunity market - doesn't:

 browser.navigate([page]);  browser.invokescript("method", new object[] { "'[string]'", "'" + [integer] + "'", [integer], "'[integer]'", "'" + [integer] + "'" }); 

/

 browser.navigate("http://steamcommunity.com/market/listings/730/pp-bizon%20%7c%20sand%20dashed%20%28field-tested%29");  browser.loadcompleted += webbrowser_pageloaded; 

and in webbrowser_pageloaded:

 browser.invokescript("buymarketlisting", new object[] { "'listing'", "'" + listingid + "'", 730, "'2'", "'" + assetid + "'" }); 

update 1: http://www.seleniumhq.org/ opens new window. can done in background without opening new one? and: don't cookies working =/

update 2: solving window problem selenium+phantomjs

now there still problem cannot react new input form opens. + problem2: cookies still don't work

i not entirely sure trying do, seems doing automatic ui testing mimic button clicking. there's tool called selenium automatic ui testing , it's relatively easy work with.

http://www.seleniumhq.org/


Comments