Reputation: 5968
At work we have 7 tools that I have to launch every morning. All the tools are on web pages.
So I have to open 7 links and click several buttons to launch the tools.
I would like to automate this operation. I used a C# code (similar to this one) which works fine
SHDocVw.InternetExplorer ie = new SHDocVw.InternetExplorer();
ie.Visible = true;
ie.Navigate("https://www.google.co.in");
//Wait for page to load
while (ie.Busy)
{
Threading.Thread.Sleep(100);
}
dynamic allLinks = ((mshtml.IHTMLDocument3)ie.Document).getElementsByTagName("a");
foreach (mshtml.IHTMLAnchorElement link in allLinks) {
//Do some validation to find out the required link
if (link.href.Contains("https://accounts.google.com/ServiceLogin")) {
link.click();
}
}
But actually we are not allowed anymore to use C# for licence reasons...
Is there any way to do that in HTML/Javascript ? (Open a link and click a button on it)
I'm not asking someone to do the work for me, but if you just have a nice tutorial or tip to look at it will be great.
Thank you.
Upvotes: 0
Views: 280
Reputation: 8007
You can use Javascript and use
window.open("www.url.com","_self")
to open the links.
You can find more info on window.open @ http://www.w3schools.com/jsref/met_win_open.asp
Upvotes: 1
Reputation: 6903
You could just set-up your browser to open all 7 as home pages when it starts up.
Upvotes: 0
Reputation: 10071
You could use a selenium framework, have a look at this one for example https://code.google.com/p/selenium/wiki/WebDriverJs
http://webdriver.io/ this is for Node.js
and here's a tutorial http://code.tutsplus.com/tutorials/an-introduction-to-webdriver-using-the-javascript-bindings--cms-21855
Upvotes: 1