Giter VIP home page Giter VIP logo

simplebrowser.webdriver's Issues

Shoulkd this example work?

Not sure if this is the right place or not? I get no element found for wd.FindElement(By.Id("gbqfq")).Click(); this is all the code:
[TestClass]
public class UnitTest3
{
[TestMethod]
public void Debit_WithValidAmount_UpdatesBalance()
{
//IWebDriver wd = new RemoteWebDriver(DesiredCapabilities.Firefox());
IWebDriver wd = new SimpleBrowser.WebDriver.SimpleBrowserDriver();
try
{
wd.Navigate().GoToUrl("https://www.google.com/");
wd.FindElement(By.Id("gbqfq")).Click();
wd.FindElement(By.Id("gbqfq")).Clear();
wd.FindElement(By.Id("gbqfq")).SendKeys("fiserv");
wd.FindElement(By.Id("gbqfb")).Click();
if (!wd.FindElement(By.TagName("html")).Text.Contains("Fiserv: Financial Services Technology, Mobile Banking ..."))
{
Console.Error.WriteLine("verifyTextPresent failed");
}
}
finally { wd.Quit(); }

Failing tests using WebDriver 0.5.0

In Form.cs there are several tests that fail and there is also a couple of build errors.

Test failures

UsingLinks gives the following failure output:

selecting <form> from 29 nodes http://localhost/test Request logged: http://localhost/test?cb=&radios=first&textbox=textbox+content&textarea_a=This+is+a+full+text+part with+several+line breaks+in+it. ++++&optionsList=opt1&colorBox=

Textarea not posted correctly
Expected: True
But was: False

at NUnit.Framework.Assert.That(Object actual, IResolveConstraint expression, String message, Object[] args) at NUnit.Framework.Assert.That(Boolean condition, String message) at DriverTest.Form.SubmitGetForm() in Form.cs: line 158

SubmitGetForm gives the following failure output:

selecting <a> from 29 nodes http://www.google.com/search?q=teun Redirecting to: http://www.google.com/webhp Request logged: http://www.google.com/search? http://www.google.com/webhp Redirecting to: http://www.google.se/webhp Request logged: http://www.google.com/webhp http://www.google.se/webhp Request logged: http://www.google.se/webhp

Link has resulted in unexpected request
Expected: True
But was: False

at NUnit.Framework.Assert.That(Object actual, IResolveConstraint expression, String message, Object[] args) at NUnit.Framework.Assert.That(Boolean condition, String message) at DriverTest.Form.UsingLinks() in Form.cs: line 31

Build errors

Both SubmitPostForm and PostAspnetPostbackForm have build errors. Both errors are similar as they fail when putting PostData in a NameValueCollection variable when it is a string.

The offending lines are at 193 and 240 and look like this:

          lastRequest = logged.PostData;

I'm using WebDriver 0.5.0.

Make a NuGet package

Just a friendly reminder to make this project into a NuGet package and get it published into the official NuGet feed.

It would be easier to do so when SimpleBrowser is published on the official feed.

Can I change the value of the host header?

I want to test against a web site set up in IIS with proper bindings to a domain, but that domain does not actually exist in dns. Without modifying my hosts file.

Here is the equivalent, using a raw WebRequest:

var req = (HttpWebRequest)WebRequest.Create("http://204.144.122.223");
req.Host = "www.asldkfhjawoeij.com";
Console.WriteLine(req.GetResponse().GetResponseStream().ReadToEnd());

I posted a SO question as well.

Thanks,
Josh

Can't get html element

Using SimpleBrowser, I can't get the html element:

driver.FindElement(By.TagName("html"))

This throws a NoSuchElementException. It works fine with the FireFox driver.

By.XPath broken in latest

I just updated to SimpleBrowser.0.5.45.0 & SimpleBrowser.WebDriver.0.5.30. Now By.XPath is broken. Example:

    {
        var by = By.XPath("//input[contains(@id, 'foo')]");
        return browser.FindElement(by);
    }

Exception:

System.ArgumentNullException : Value cannot be null.
Parameter name: node

at System.Xml.XPath.Extensions.XPathSelectElements(XNode node, String expression, IXmlNamespaceResolver resolver)
at SimpleBrowser.WebDriver.WebElement.FindElementsByXPath(String xpath)
at SimpleBrowser.WebDriver.WebElement.FindElementByXPath(String xpath)
at OpenQA.Selenium.By.<>c__DisplayClasse.b__c(ISearchContext context)
at OpenQA.Selenium.By.FindElement(ISearchContext context)
at SimpleBrowser.WebDriver.SimpleBrowserDriver.FindElement(By by)

Error loading SimpleBrowser dll

Hey, I am using Specflow with SimpleBrowser and have added SimpleBrowser and SimpleBroswer.Driver nuget packges to my project. However, when I try to instantiate a new driver as:

var driver = new SimpleBrowserDriver();

I get following exception
System.TypeLoadException : Could not load type 'SimpleBrowser.Browser' from assembly 'SimpleBrowser, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'. at SimpleBrowser.WebDriver.BrowserWrapper..ctor() at SimpleBrowser.WebDriver.SimpleBrowserDriver..ctor() at SimpleBrowser.Steps.GivenGivenILoginToGatewayAdmin() in d:\Study\SimpleBrowser\Steps.cs:line 34

What am I missing here? I also have references to Selenium.WebDriver and Selenium.Support. Here is my packages.config:

<?xml version="1.0" encoding="utf-8"?> <packages> <package id="NUnit" version="3.0.0" targetFramework="net45" /> <package id="Selenium.Support" version="2.46.0" targetFramework="net452" /> <package id="Selenium.WebDriver" version="2.46.0" targetFramework="net452" /> <package id="SimpleBrowser" version="0.5.79.0" targetFramework="net452" /> <package id="SimpleBrowser.WebDriver" version="0.5.37" targetFramework="net452" /> <package id="SpecFlow" version="2.1.0" targetFramework="net45" /> <package id="SpecFlow.NUnit" version="2.1.0" targetFramework="net45" /> <package id="SpecRun.SpecFlow" version="1.5.2" targetFramework="net45" /> </packages>

ImplicitlyWait() throws NullReferenceException.

Hi, I have this small problem. When I tell the browser to wait for HTML before to continue, I recieve a NullReferenceException. I tried this block with FirefoxDriver and worked fine.

simpleDriver.Manage ().Timeouts ().ImplicitlyWait (TimeSpan.FromSeconds (10));

Frames

Hello, simplebrowser can work with frames?

Browser simpleBrowser = new Browser();
IWebDriver driver = new SimpleBrowserDriver(new BrowserWrapper(simpleBrowser));
driver.Navigate().GoToUrl("http://www.google.ru/");
IWebDriver frame = driver.SwitchTo().Frame(driver.FindElement(By.XPath("/html[1]/body[1]/iframe[1]")));

throw NotImplementedException

Needs Cookie Support!

browser.Manage().Cookies throws a Not Implemented exception.

Yet Simple.Browser has a Property called Cookie of type CookieContainer. Which could be easily mapped to ICookieJar

Close and Quit throw NotImplementedExceptions

Is there a reason that these methods throw NotImplementedExceptions instead of just doing nothing? My issue is that when you use the FirefoxDriver, you must call quit or else windows stay active. Going out of scope would cause SimpleBrowser to "close," so is there any harm in just letting these methods be called but just not doing anything?

If we wanted 'close' to do something, we could alter SimpleBrowser so that new windows track their parent and when you call 'close,' the browser instance tells its parent to remove it from its 'Windows' property.

Thoughts?

Started with some script support anyway

I have created a branch in SimpleBrowser and in SimpleBrowser.WebDriver both called "js". In SimpleBrowser, I had to expose the click event so I could use it in SimpleBrowser.WebDriver. Well, I have seen that Browser.cs contains some event handlers so I added one. Most changes are in SimpleBrowser.WebDriver.

As I understand it, you guys thinks it is a beast to include scripting in your project(s). I understand if you think so. On the other hand, if there is no javascript support, the test environment is very limited. In the long run people would perhaps expect scripting support. Without scripting, SimpleBrowser webdriver is also not sufficient for my own purposes.

The script support is still very rudimentary, but there is support for window.alert, console.log, document.createElement, body.onload, click events etc. The unit test cases should serve as a list of what is supported. The script engine I have used is ClearScript. There is still some work to do to get a decent DOM, but it is extremely easy to extend it. The goal will not be to imitate a full browser in a near future, but to be able to perform testing on websites. The reason I take interest in theese projects is that I have created a lot of webpages that needs test harnesses.

No handling of css has (yet) been added.

There is a test framework called phantomJS, but I did not like is a lot. It seems to have two modes, one where you have access to your own variables, nothing else and one where you run in a sandbox, and all you have access to is the script of the webpage you are testing, not your variables. So although you write tests in a scripting language, your options are less flexible and it felt a bit clumsy.

If you guys are interested in sooner or later adding my code to your project(s), maybe you think adding scripting is not that dramatic after all, maybe you also think it is a good idea to merge SimpleBrowser and SimpleBrowser.WebDriver? let me know. If you think the burden will be too high, the support mails too many etc, then let me know if I am free to create an offspring of your project(s). I would of course prefer to cooperate with you.

Can,t Set WordPress Post Tags

Im trying to send a Wordpress post by Simple browser, everything works great! but when I get the tags field by id or name and set the value to the field value is set in Browser but when I publish the post my post published without tags. I tried many ways to do this (eg: get element by tag name, name, value, id, set attribute etc.) but the results are the same! the post published without any tags. Thanks for your help!

The Tags field element :

<input data-wp-taxonomy="download_tag" type="text" id="new-tag-download_tag" name="newtag[download_tag]" class="newtag form-input-tip ui-autocomplete-input" size="16" autocomplete="off" aria-describedby="new-tag-download_tag-desc" value="" role="combobox" aria-autocomplete="list" aria-expanded="false" aria-owns="ui-id-1">
My code Like this:

//Ttitle
b.Find("input", FindBy.Id, "title").Value = "TestPost";
//Discreption
var a = b.FindAll("textarea");
foreach (var item in a)
{
a.Value = "Test";
}
//Select Category
var c = b.Select(".selectit input[type='checkbox']");
foreach (var item in c)
{
if (item.XElement.Parent.Value.Contains("Article"))
{
item.Checked = true;
}
}
//Set Tags (This part is not working)
var tin = b.Find("input", FindBy.Id,"new-tag-download_tag");
foreach (var item in tin)
{
item.Value = "test1,test2,test3";
}
b.Find("publish").Click();

Frames issue

I have tried using SimpleBrowser with the following code for music.cbc.ca

            SetupFixture.Driver.SwitchTo().Frame("client");

            SetupFixture.Driver.FindElement(By.XPath("//div[@id='userBox']/div[@id='join']/a")).Click();

Works with the FireFoxDriver , but fails with the SimpleBrowser WebDriver

Click navigation in "new window/tab"

In my scenario, I want to click every link from each row of a table, examine the navigated page and move on to the next link.

Is there a way to "open in new tab" or effectively clone the browser object so that I don't have to keep track of a row index and navigate back for each subsequent row in the original table?

Does that make sense?

Not updated with SimpleBrowser latest version?

There are couple of additional method available in SimpleBrowser to support HTTP POST as well, but not on WebDriver. Any specific reason or this is not updated?

public bool Navigate(Uri url, string postData, string contentType);
public bool Navigate(Uri url, NameValueCollection postData, string contentType = null, string encodingType = null);

Increase parallel TCP connections?

I'm trying to use SimpleBrowser as a load testing client, and it's practically ideal for this. However, I can't find away around the nearly linear performance degradation with the instance count. I did notice that no matter how many instances I spin up, TCP connections max out at 2. Is there a way to increase the connections, or some other trick for getting better parallelism?

Method not found: 'Void SimpleBrowser.Browser..ctor

Environment

  • SimpleBrowser.WebDriver 0.5.33
  • SimpleBrowser 0.5.61.0
  • Selenium.WebDriver 2.46.0

Steps
I am trying to initialize new SimpleBrowserDriver

protected static IWebDriver Driver { get; set; }
private static void CreateDriver(string browser)
{
if (browser == null)
            {
                 Driver = new SimpleBrowserDriver();
            }
...
 }

Issue
Error appears

 System.MissingMethodException : Method not found: 'Void SimpleBrowser.Browser..ctor(SimpleBrowser.Network.IWebRequestFactory, System.String)'.

StackTrace

   at SimpleBrowser.WebDriver.BrowserWrapper..ctor()
   at SimpleBrowser.WebDriver.SimpleBrowserDriver..ctor()
   at PartnerDashboardUI.Framework.PageObject.CreateDriver(String browser) in PageObject.cs: line 383
   at PartnerDashboardUI.Framework.PageObject.StartBrowser() in PageObject.cs: line 257
   at PartnerDashboardUI.Test.SetUpFixture.SuiteSetUp() in SetUpFixture.cs: line 40

Browser navigation error when port number in URL

Hi there,

The error I'm seeing has nothing directly to do with SimpleBrowser.WebDriver. At least I don't think it does. I believe the problem is in SimpleBrowser.

I'm brand new to .NET and Visual Studio 2010, but I did simple Microsoft tutorial on MVC3 to try to learn about the platform. Being an old eXtreme Programming guy, I wanted to write acceptance tests. So I poked around and found SpecFlow. Then I found SimpleBrowser and SimpleBrowser.WebDriver, which seem like perfect tools for headless web app testing. With that context...

I was seeing an error in my sample app when I tried to use SimpleBrowser.WebDriver to click this link on a page:

http://localhost:2118/movies/Create

The click simply didn't work. It would execute, but it had no effect (i.e., no navigation occurred). I suspected the issue was with SimpleBrowser, so I removed your project from my References and pointed straight to SimpleBrowser. After some debugging I isolated the problem.

As I'm sure you know, the Browser class (Browser.cs) has a method named DoRequest(). That method builds a URL to execute an HttpRequest with. At line 262 in my file, I find this statement:

uri = new Uri(uri.Scheme + "://" + uri.Host + uri.AbsolutePath + "?" + StringUtil.MakeQueryString(userVariables));

That takes the original URI and builds a new one for methods other than POST. Notice that it strips the port number from between uri.Host and uri.AbsolutePath. I changed the line to this:

uri = new Uri(uri.Scheme + "://" + uri.Host + ":" + uri.Port + uri.AbsolutePath + "?" + StringUtil.MakeQueryString(userVariables));

Now it works like a charm, and can find that link I was trying to click.

You don't control SimpleBrowser, obviously, but you use it, so I figured you'd want to know. I would very much like to use SimpleBrowser.WebDriver because the interface is very nice, but I can't use it until SimpleBrowser lets me click my links.

By the way, when I try to load your VS solution file, VS tells me I can't load it up because of these errors:

C:\Documents and Settings\Roy\My Documents\browserdrivers\Teun-SimpleBrowser.WebDriver-794abf4\SimpleBrowser.WebDriver\SimpleBrowser.WebDriver.csproj : error : Unable to read the project file 'SimpleBrowser.WebDriver.csproj'.
C:\Documents and Settings\Roy\My Documents\browserdrivers\Teun-SimpleBrowser.WebDriver-794abf4\SimpleBrowser.WebDriver\SimpleBrowser.WebDriver.csproj(80,3): The imported project "C:\Documents and Settings\Roy\my documents\visual studio 2010\Projects\MvcMovie.nuget\nuget.targets" was not found. Confirm that the path in the declaration is correct, and that the file exists on disk.

C:\Documents and Settings\Roy\My Documents\browserdrivers\Teun-SimpleBrowser.WebDriver-794abf4\DriverTest\DriverTest.csproj : error : Unable to read the project file 'DriverTest.csproj'.
C:\Documents and Settings\Roy\My Documents\browserdrivers\Teun-SimpleBrowser.WebDriver-794abf4\DriverTest\DriverTest.csproj(116,3): The imported project "C:\Documents and Settings\Roy\my documents\visual studio 2010\Projects\MvcMovie.nuget\nuget.targets" was not found. Confirm that the path in the declaration is correct, and that the file exists on disk.

I'm not sure what's wrong. I downloaded your stuff and extracted to my hard drive. Didn't seem like a tough task :) But I can't add it to my own solution in VS. I can add it as a reference via NuGet without any problem at all.

Thanks for your time.

Roy

Cookies are lost

I'm trying to automate some browser actions using SimpleBrowserDriver which includes logging in to a website and then performing some further actions. This fails, I think because the cookies are lost (or perhaps blocked, cross-site detection maybe?). This exact code, however, does work when simple replacing SimpleBrowserDriver() with FirefoxDriver(). Of course, this opens an instance of Firefox to accomplish this but there are obviously some differences here with regards to how cookies are handled. Can you provide any assistance or explanation? (full code can be provided if necessary) Many thanks, Phil

Proxy support

Hi guys,

I wanted to use SimpleBrowser.WebDriver with a proxy configuration. In the normal WebDriver you can use the ICapabilities interface to pass the proxy in the constructor of your webdriver, however the SimpleBrowser.WebDriver constructor does not take any parameters.

Is there any way to pass a proxy?

Now, why I want to use a proxy is a different discussion. It has to do with our automated environments that live in a different domain/network from the TeamCity agents.

Any issue for elements inside <noscript> ?

Hi Guys,

I have an issue with a dropdown element that placed inside tag.
For example:

Select your state Alabama Alaska Arizona

//my code to select state dropdown option
ReadOnlyCollection options = _driver.FindElements(By.TagName("option"));

    foreach (IWebElement option in options)
    {
        if (selectedValue.Trim().ToLower() == option.Text.ToLower())
        {
            option.Click();
        }
    }

//my code to go to the next page
IWebElement submitButton = _driver.GetElement(By.Id("form-noscript"));

After code "option.Click()" is triggered, I can see that the "Selected" property is True. However when I check on the PageSource, the option is still not selected, and the result when form-noscript is submitted, the system will not direct me to the next page.

Is there any settings that I need to set to have this working? or probably I missed something on this one?

Regards,
Budi

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

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.