SimpleBrowserDotNet / SimpleBrowser.WebDriver

A webdriver for SimpleBrowser
Apache License 2.0
43 stars 16 forks source link

WebDriver: using FindElement(By...).Click() fails when multiple elements are found #10

Closed yetanotherchris closed 11 years ago

yetanotherchris commented 12 years ago

If you try to click an element on the page, and more than one element is found, then SimpleBrowser throws a InvalidOperationException.

The behaviour of FirefoxDriver (and the others) is to simply click the first element it finds.

If no elements are found, a NoSuchElementException is thrown, with the selector details in the details.

WebElement constructor appears to be the source of the problem: if (_my.TotalElementsFound != 1)

Teun commented 12 years ago

Thanks for your reports, in a few weeks I'll be back from holidays and I'll make sure that these get resolved.

Teun Op 14 sep. 2012 13:05 schreef "Chris" notifications@github.com het volgende:

If you try to click an element on the page, and more than one element is found, then SimpleBrowser throws a InvalidOperationException.

The behaviour of FirefoxDriver (and the others) is to simply click the first element it finds.

If no elements are found, a NoSuchElementException is thrown, with the selector details in the details.

WebElement constructor appears to be the source of the problem: if (_my.TotalElementsFound != 1)

— Reply to this email directly or view it on GitHubhttps://github.com/Teun/SimpleBrowser.WebDriver/issues/10.

Teun commented 11 years ago

I am having a bit trouble reproducing the first part of your report. I have this test code:

var anchor = driver.FindElement(By.TagName("a")); // finds multiple, selects the first
Assert.That(anchor.TagName == "a");

Assert.Throws(typeof(NoSuchElementException), ()=>driver.FindElement(By.TagName("nosuchtag")));

Both run fine (the NoSuchElementException I have fixed). Can you send some test code that fails?

yetanotherchris commented 11 years ago

Looks like it's working ok now. I have a lot of issues when switching from FirefoxDriver/ChromeDriver to SimpleDriver (not JS related), some are NotImplementedExceptions but others are from "." selectors not working correctly. Should I make a new ticket for this, or are these known about already?

Teun commented 11 years ago

The issues in the github project are the only ones that I know of. I am aware that there are numerous places throwing NotImplemented, but I will typically work on the things that have issues created for them. I must say that I haven't spent much time on out lately. Priorities...

Teun Op 11 dec. 2012 13:00 schreef "Chris" notifications@github.com het volgende:

Looks like it's working ok now. I have a lot of issues when switching from FirefoxDriver/ChromeDriver to SimpleDriver (not JS related), some are NotImplementedExceptions but others are from "." selectors not working correctly. Should I make a new ticket for this, or are these known about already?

— Reply to this email directly or view it on GitHubhttps://github.com/Teun/SimpleBrowser.WebDriver/issues/10#issuecomment-11240931.