public CommandExecutionResult Execute(OpenQA.Selenium.IWebDriver driver) { try { driver.Navigate().GoToUrl(Target); return new CommandExecutionResult { CommandResult = CommandResult.Success, Message = string.Empty }; } catch (TimeoutException ex) { return new CommandExecutionResult { CommandResult = CommandResult.TimedOut, Message = ex.Message }; } catch (Exception ex) { return new CommandExecutionResult { CommandResult = CommandResult.Failed, Message = ex.Message }; } }
/// <summary> /// runs all 4 social media sites by selecting website/navigating to and running Run app method /// </summary> /// <param name="Dervalue">the value of 5</param> /// <param name="startSearch">i web driver DOM of page</param> internal static void RunAllSocialMediaSites(int Dervalue, OpenQA.Selenium.IWebDriver startSearch) { //BBotChecker nr = new BBotChecker(); string uName ="", uPass =""; Dervalue -= 1 ; for (int socialRun = 1; Dervalue >= socialRun ; socialRun++) { //needed to set radio value that selectwebaddress depends on var mediaSite = BBotChecker.SetRadioName(socialRun); // sets the url System.Threading.Thread.Sleep(10000); BBotChecker.SelectWebAddress(mediaSite); startSearch.Navigate().GoToUrl(BBotChecker.SetURL); uPass = BBotChecker.Passwords[socialRun -1]; uName = BBotChecker.Usernames[socialRun -1 ]; RunApp(startSearch, uName, uPass, socialRun); } }
public Messages.BaseResult ExecuteTest(OpenQA.Selenium.IWebDriver driverToTest, Parser.TestItem itemToTest) { BaseResult br = new BaseResult(); try { string domainUrl = new Uri(driverToTest.Url).GetLeftPart(UriPartial.Authority); // TODO: Modify passing of the base url? Is it really necessary? Input parameter? driverToTest.Navigate().GoToUrl(domainUrl + itemToTest.Selector); br.Status = true; br.Message = "OK"; } catch (Exception e) { #if DEBUG throw; #endif br.Status = false; br.Message = string.Format("Exception type: {0}. Message: {1}.", e.GetType(), e.Message); } return br; }