Closed yetanotherchris closed 12 years ago
Hi Chris,
I've been trying to reproduce your issue, but unsuccessfully. Can you have a look at this test code and see where I did not understand your issue?
[Test]
public void FrameMayHaveInvalidUrls_Issue9()
{
IBrowser b = new BrowserWrapper(new Browser(Helper.GetAllways200RequestMocker(
new List<Tuple<string, string>>()
{
Tuple.Create("^/frame", @"<html><a href=""javascript:"">link</a></html>"),
Tuple.Create("^.*", @"
<html>
<iframe src=""/frame""/><iframe name=""inv"" src=""javascript:""/>
</html>"),
}
)));
var dr = new SimpleBrowserDriver((IBrowser)b);
b.Navigate("http://blah/");
foreach (var item in b.Frames)
{
Console.WriteLine(item.Url);
Console.WriteLine(item.CurrentHtml);
}
//when clicking a javascript: URL it throws an exception. It this your problem?
Assert.Throws<UriFormatException>(() => { b.Frames.First().Select("a").Click(); });
}
The website I was using was totaljobs.com - that uses javascript:''
It'd be handy if there was an option to just ignore iframes.
I can load it without problem using
var b1 = new SimpleBrowserDriver();
b1.Navigate().GoToUrl("http://www.totaljobs.com/");
Can you give me some failing sample code?
This snippet is what's triggering it:
SimpleBrowserDriver driver = new SimpleBrowserDriver(); driver.Navigate().GoToUrl("http://www.totaljobs.com"); driver.FindElement(By.Id("top_0_txtKeywords")).SendKeys("accountant"); driver.FindElement(By.Id("top_0_btnSearch")).Click();
Console.Read();
On Sun, Oct 7, 2012 at 7:44 PM, Teun notifications@github.com wrote:
I can load it without problem using var b1 = new SimpleBrowserDriver(); b1.Navigate().GoToUrl("http://www.totaljobs.com/");
Can you give me some failing sample code?
— Reply to this email directly or view it on GitHubhttps://github.com/Teun/SimpleBrowser.WebDriver/issues/9#issuecomment-9210880.
I've just pushed a version of SimpleBrowser and SimpleBrowser.WebDriver that should fix this problem. Thanks for reporting. I hope this fixes your issue.
If an iframe (or possibly other links) have href="javascript:", SimpleBrowser throws an exception.
Weirdly, new Uri("javascript:") is valid, but creating the web request fails.