Giter Club home page Giter Club logo

Comments (3)

dtu11 avatar dtu11 commented on July 20, 2024

Can you provide the version you're working with and the code of your test script?

Thanks

from easyrepro.

WinniB avatar WinniB commented on July 20, 2024

Sorry, my description was bad, i try to explain it more detailed: I want to check a checkbox on page. The first error occured was that the element could not be found. This is because in the "SetValue" function the element id get the "int_" prefix.
In order to use the "SetValue" function i had to change the id from "int_" + field to field
After this change the driver is now able to find the checkbox, but when .GetAttribute("checked") is executed I get an exception: "Value cannot be null. Parameter name: value"

  • We use Microsoft Dynamics 365 Version 1612 (8.2.2.136) on-premises
  • The code I try to ckeck the checkbox : entity.SetValue("my_checkbox", true);
  • The code after changing the "SetValue" function:
public BrowserCommandResult<bool> SetValue(string field, bool check)
{
	return this.Execute(GetOptions($"Set Value: {field}"), driver =>
	{
		if (driver.HasElement(By.Id(field)))
		{
			var input = driver.FindElement(By.Id(field));

			if (bool.Parse(input.FindElement(By.TagName("input")).GetAttribute("checked")) && !check)
				input.FindElement(By.TagName("input")).Click();
		}
		else
			throw new InvalidOperationException($"Field: {field} Does not exist");

		return true;
	});
}

from easyrepro.

j621z avatar j621z commented on July 20, 2024

@WinniB This fix will be pushed soon. In the mean time, please try running this code. The issue is the "checked" attribute is not present in the "input" tag.

public BrowserCommandResult<bool> SetValue(string field, bool check)
{
	return this.Execute(GetOptions($"Set Value: {field}"), driver =>
	{
		if (driver.HasElement(By.Id(field)))
		{
			var input = driver.FindElement(By.Id(field));
			var checkBox = input.FindElement(By.TagName("input"));
			var bCheck = checkBox.GetAttribute("value") == "1";

			if (bCheck != check)
			{
				checkBox.Click();
			}
		}
		else
			throw new InvalidOperationException($"Field: {field} Does not exist");

		return true;
	});
}

from easyrepro.

Related Issues (20)

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.