0

I am looking for a C# script base that Will Add Current URLS to the IE Bookmarks that do not require building a separate class call. I am trying to build a script that takes the current URL and saves it to the Favorites... Any Help would be appreciated Im a noob and Im trying to figure this out. Im trying to save off the cookie right now but that doesnt seem promising

 Manager.LaunchNewBrowser();

 const string url = "www.google.com";
{
var cookie = new Cookie("foo", "bar", "/", url);
cookie.Expires = DateTime.MaxValue;
var ok = ActiveBrowser.Cookies.SetCookie(cookie);
}

var c = ActiveBrowser.Cookies.GetCookies("http://www.google.com");
var count = c.Count;

Log.WriteLine(count.ToString());
foreach (Cookie cookie in ActiveBrowser.Cookies.GetCookies("http://www.google.com"))
{
Log.WriteLine(cookie.Name);
}

1 Answers1

3

C# is not a scripting language, it's a server-side programming language part of the Microsoft .NET (dot net) platform. You should use Javascript (JS) for client-side scripting in the browser.

Please read, for example, the answers posted to this StackOverflow question:

How do I add an "Add to Favorites" button or link on my website?

(and of course there are many more examples to find around the web, through your favorite search engine).

Community
  • 1
  • 1
Doku-so
  • 346
  • 3
  • 9
  • Thanks for the Information. Here is what I am currently trying. To give more background. This is a session based test. We are logging into our site. Saving off the landing page. Going through the site and then accessing that URL we bookmarked to see if it brings us back to the same page within the same session. Then further test start new sessions and call that Bookmark again to validate that the session has terminated and can not be accessed via the Bookmark. – user2240934 Apr 03 '13 at 16:08