Permalink
Browse files

Multiple updates

  • Loading branch information...
1 parent 3255cb8 commit 991654e06293c1438e68044607c0c78c07e2e0b6 @DinisCruz DinisCruz committed Sep 24, 2013
@@ -57,12 +57,15 @@ public API_Chrome_Hijack open_ChromeDriver()
ChromeDriver = new ChromeDriver(ChromeDriverService, ChromeOptions);
//resolve driverServiceProcess
- var fieldInfo = (FieldInfo)typeof(DriverService).field("driverServiceProcess");
- ChromeDriverProcess = (Process)fieldInfo.GetValue(ChromeDriverService);
+ //var fieldInfo = (FieldInfo)typeof(DriverService).field("driverServiceProcess");
+ var fieldInfo = typeof(DriverService).fieldInfo("driverServiceProcess");
+ if (fieldInfo.notNull())
+ {
+ ChromeDriverProcess = (Process)fieldInfo.GetValue(ChromeDriverService);
- ChromeDriverProcess.waitFor_MainWindowHandle();
- ChromeProcess = ChromeDriverProcess.getProcessWithParentHandle();
-
+ ChromeDriverProcess.waitFor_MainWindowHandle();
+ ChromeProcess = ChromeDriverProcess.getProcessWithParentHandle();
+ }
return this;
}
@@ -1,6 +1,6 @@
//var topPanel = panel.clear().add_Panel();
var topPanel = "Util - Chrome with REPL".popupWindow(1200,600);
-
+
var replPanel = topPanel.add_GroupBox("C# Repl").add_Panel();
var chromeHijack = new API_Chrome_Hijack().open_ChromeDriver()
@@ -14,7 +14,7 @@ chromeDriver.FindElement(By.Name(""q""))
chromeDriver.FindElement(By.Name(""btnG""))
.Click();
return ""done"";
-
+//using O2.XRules.Database.APIs
//using OpenQA.Selenium;
//O2Ref:WebDriver.dll
//O2File:API_ChromeDriver.cs";
@@ -18,9 +18,9 @@ public class EasyHook_Installer : Tool_API
public EasyHook_Installer()
{
config("EasyHook",
- "EasyHook 2.6 Binaries.zip",
- "http://download-codeplex.sec.s-msft.com/Download/Release?ProjectName=easyhook&DownloadId=61309&FileTime=128810691555630000&Build=19727".uri(),
- "README.txt");
+ "EasyHook-2.7.4761.0-Binaries.zip",
+ "http://download-codeplex.sec.s-msft.com/Download/Release?ProjectName=easyhook&DownloadId=371803&FileTime=130025275074470000&Build=20748".uri(),
+ "NetFX4.0\\README.txt");
installFromZip_Web();
}
@@ -34,7 +34,6 @@ files.afterSelect<string>(
});
files.onDrop(extractClassesFromJar);
-//using O2.XRules.Database.APIs
//O2File:API_Jad.cs
//O2EmbedTool:Jad
@@ -5,6 +5,9 @@ var urlTemplate = "https://nuget.org/api/v2/Search()?$filter=IsLatestVersion&$or
var start = DateTime.Now;
var top = 30;
var skip = 0;
+
+targetDir.startProcess();
+
while(skip < 20000)
{
var url = urlTemplate.format(skip, top);
@@ -19,4 +22,6 @@ while(skip < 20000)
}
skip+= top;
}
+
+
return start.duration_To_Now();
@@ -18,7 +18,7 @@ public Selenium_Installer()
{
config("Selenium",
"http://selenium.googlecode.com/files/selenium-dotnet-2.33.0.zip".uri(),
- @"Selenium\WebDriver.dll");
+ @"Selenium\net40\WebDriver.dll");
installFromZip_Web();
}
@@ -0,0 +1,91 @@
+//var topPanel = "{name}".popupWindow(700,400);
+Web.Https.ignoreServerSslErrors(); // in case we have fiddler on
+
+//var topPanel = panel.clear().add_Panel(); // use when in developent
+var topPanel = "PoC - View TeamMentor Article (using GUID)".popupWindow(1200,500); // use when done
+
+Func<string,string,string,string> getArticle =
+ (contentType, articleId, sessionId)
+ =>{
+ var tmArticleUrl = "https://teammentor.net/{0}/{1}"; // REST GET call for content
+ return tmArticleUrl.format(contentType,articleId) // set contentType and session
+ .GET("Session=" + sessionId); // make GET request with provided cookie value
+ };
+
+Func<string,string> wrapCss =
+ (bodyContent) =>{
+ return @"<html>
+ <head>
+ <link href='http://getbootstrap.com/dist/css/bootstrap.css' rel='stylesheet'>
+ </head>
+ <body>
+ {0}
+ </body>
+ </html>".format(bodyContent);
+ };
+
+Action loadData = null; // placeholder for this lamda method
+
+var configPanel = topPanel.insert_ActionPanel();
+var username_TextBox = configPanel .add_Label ("Username:" ).top(2).append_TextBox("");
+var password_TextBox = username_TextBox.append_Label("Password:" ).top(2).append_TextBox("").isPasswordField();
+var article_TextBox = password_TextBox.append_Label("Article to Show").top(2).append_TextBox("").width(400);
+var loadData_Link = article_TextBox .append_Link ("Load Data" , () => loadData());
+
+var htmlViewer = topPanel.title ("Article as Html" ).add_WebBrowser().silent(true); // use webBrowser to see article's content
+var rawViewer = topPanel.insert_Right("Article as Raw" ).add_WebBrowser().silent(true); // use webBrowser to see article's object as jsonp
+var jsonpViewer = topPanel.insert_Below("Article as Jsonp").add_WebBrowser().silent(true); // use webBrowser to see article's object as raw xml
+
+Func<string,string,string> getLoginId =
+ (username, password)
+ =>{
+ var loginRequest = "https://teammentor.net/rest/login/{0}/{1}" // create GET URL
+ .format(username, password);
+ return username.add(password) // use username+password as cache key
+ .o2Cache<string>(()=>loginRequest.GET().xRoot().innerXml()); // login request made here
+ };
+Action<string> showMessageInBrowsers =
+ (messageToShow)
+ =>{
+ htmlViewer .showMessage(messageToShow);
+ jsonpViewer.showMessage(messageToShow);
+ rawViewer .showMessage(messageToShow);
+ };
+Action<string,string,string> showArticle =
+ (articleId, username, password)
+ =>{
+ showMessageInBrowsers("....logging in...");
+
+ var userId = getLoginId(username, password);
+
+ if (userId.guid() == Guid.Empty) // handle failed login attempt
+ showMessageInBrowsers("...login failed! ...");
+ else
+ {
+ showMessageInBrowsers(".... loading data ...");
+ htmlViewer .set_Html(wrapCss(getArticle("content",articleId, userId)));
+ rawViewer .set_Html(getArticle("raw" ,articleId, userId));
+ jsonpViewer .set_Html(getArticle("jsonp" ,articleId, userId));
+ }
+ };
+
+loadData = ()=> showArticle(article_TextBox.get_Text(), username_TextBox.get_Text(), password_TextBox.get_Text());
+
+article_TextBox.set_Text("7d647e95-e47f-42e3-bb84-fd0dd727245c");
+
+var crendential = "TestAccounts.xml".credential("TeamMentor"); // load username/password from disk
+
+if (crendential.notNull())
+{
+ crendential.UserName.add(crendential.Password).o2Cache(null); // just in case, clear login cache
+ username_TextBox.set_Text(crendential.UserName); // set default values on TextBoxes
+ password_TextBox.set_Text(crendential.Password);
+ loadData_Link.click(); // trigger show article workflow
+}
+
+rawViewer.showMessage("... please set the login account and article Id (a GUID) on the Textboxes above ...");
+
+return "done";
+
+//using FluentSharp.CoreLib.Utils
+//O2File:_Extra_methods_To_Add_to_Main_CodeBase.cs
Oops, something went wrong.

0 comments on commit 991654e

Please sign in to comment.