Last active
October 31, 2016 21:27
-
-
Save jimevans/a824a17162c3c75a7e76d0c0c2ea0cd4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace Tests | |
{ | |
[TestClass] | |
public class uhtest : TestBase | |
{ | |
[TestMethod] | |
public void TestMethod1() | |
{ | |
Pages.SiteMap.GoTo(); | |
var allTextBoxes = Browser.Driver.FindElements(By.XPath("//a[starts-with(@href, '/c/Carts')]")); | |
foreach (var textBox in allTextBoxes) | |
{ | |
string targetUrl = textBox.GetAttribute("href"); | |
if (string.IsNullOrEmpty(targetUrl)) | |
{ | |
Console.WriteLine("Found an empty href"); | |
} | |
Uri fullUri = new Uri(targetUrl); | |
HttpWebRequest request = HttpWebRequest.Create(fullUri) as HttpWebRequest; | |
request.Method = "GET"; | |
HttpWebResponse response = request.GetResponse() as HttpWebResponse; | |
Console.WriteLine("Navigating to target {0} yielded status code {1}", targetUrl, response.StatusCode); | |
} | |
Console.WriteLine("poop"); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment