-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
interactions of elements csharp code added in github (#1728)[deploy s…
…ite] Co-authored-by: Sri Harsha <[email protected]>
- Loading branch information
1 parent
cb2ea86
commit b262a15
Showing
5 changed files
with
89 additions
and
119 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,52 @@ | ||
using System; | ||
using Microsoft.VisualStudio.TestTools.UnitTesting; | ||
using OpenQA.Selenium; | ||
using OpenQA.Selenium.Chrome; | ||
|
||
namespace SeleniumDocs.Elements | ||
{ | ||
[TestClass] | ||
public class InteractionTest : BaseTest | ||
public class InteractionTest | ||
{ | ||
[TestMethod] | ||
public void TestInteractionCommands() | ||
{ | ||
IWebDriver driver = new ChromeDriver(); | ||
driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromMilliseconds(500); | ||
|
||
// Navigate to Url | ||
driver.Navigate().GoToUrl("https://www.selenium.dev/selenium/web/inputs.html"); | ||
// Click on the element | ||
IWebElement checkInput = driver.FindElement(By.Name("checkbox_input")); | ||
checkInput.Click(); | ||
|
||
//Verify | ||
Boolean isChecked = checkInput.Selected; | ||
Assert.AreEqual(isChecked, false); | ||
|
||
//SendKeys | ||
// Clear field to empty it from any previous data | ||
IWebElement emailInput = driver.FindElement(By.Name("email_input")); | ||
emailInput.Clear(); | ||
//Enter Text | ||
String email = "[email protected]"; | ||
emailInput.SendKeys(email); | ||
|
||
//Verify | ||
String data = emailInput.GetAttribute("value"); | ||
Assert.AreEqual(data, email); | ||
|
||
|
||
//Clear Element | ||
// Clear field to empty it from any previous data | ||
emailInput.Clear(); | ||
data = emailInput.GetAttribute("value"); | ||
|
||
//Verify | ||
Assert.AreEqual(data, ""); | ||
|
||
//Quit the browser | ||
driver.Quit(); | ||
} | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -44,26 +44,23 @@ Selenium will return an [element click intercepted](https://w3c.github.io/webdri | |
|
||
|
||
{{< tabpane langEqualsHeader=true >}} | ||
|
||
{{< tab header="Java" text=true >}} | ||
{{< gh-codeblock path="examples/java/src/test/java/dev/selenium/elements/InteractionTest.java#L18-L22" >}} | ||
{{< /tab >}} | ||
{{< tab header="Python" >}} | ||
{{< tab header="Python" >}} | ||
|
||
# Navigate to url | ||
driver.get("https://www.selenium.dev/selenium/web/inputs.html") | ||
|
||
# Click on the element | ||
driver.find_element(By.NAME, "color_input").click() | ||
{{< /tab >}} | ||
{{< tab header="CSharp" >}} | ||
|
||
// Navigate to Url | ||
driver.Navigate().GoToUrl("https://www.selenium.dev/selenium/web/inputs.html"); | ||
|
||
// Click the element | ||
driver.FindElement(By.Name("color_input")).Click(); | ||
|
||
{{< tab header="CSharp" text=true >}} | ||
{{< gh-codeblock path="examples/dotnet/SeleniumDocs/Elements/InteractionTest.cs#L17-L21" >}} | ||
{{< /tab >}} | ||
|
||
{{< tab header="Ruby" >}} | ||
|
||
# Navigate to URL | ||
|
@@ -117,20 +114,12 @@ possible keystrokes that WebDriver Supports. | |
driver.find_element(By.NAME, "email_input").send_keys("[email protected]" ) | ||
|
||
{{< /tab >}} | ||
{{< tab header="CSharp" >}} | ||
|
||
// Navigate to Url | ||
driver.Navigate().GoToUrl("https://www.selenium.dev/selenium/web/inputs.html"); | ||
|
||
// Clear field to empty it from any previous data | ||
driver.FindElement(By.Name("email_input")).Clear(); | ||
|
||
//Enter Text | ||
driver.FindElement(By.Name("email_input")).SendKeys("[email protected]"); | ||
|
||
|
||
} | ||
{{< tab header="CSharp" text=true >}} | ||
{{< gh-codeblock path="examples/dotnet/SeleniumDocs/Elements/InteractionTest.cs#L27-L33" >}} | ||
{{< /tab >}} | ||
|
||
|
||
{{< tab header="Ruby" >}} | ||
|
||
# Navigate to URL | ||
|
@@ -184,18 +173,13 @@ with a`content-editable` attribute. If these conditions are not met, | |
|
||
|
||
{{< /tab >}} | ||
{{< tab header="CSharp" >}} | ||
|
||
// Navigate to Url | ||
driver.Navigate().GoToUrl("https://www.selenium.dev/selenium/web/inputs.html"); | ||
|
||
// Clear field to empty it from any previous data | ||
driver.FindElement(By.Name("email_input")).Clear(); | ||
|
||
|
||
|
||
} | ||
{{< tab header="CSharp" text=true >}} | ||
{{< gh-codeblock path="examples/dotnet/SeleniumDocs/Elements/InteractionTest.cs#L40-L43" >}} | ||
{{< /tab >}} | ||
|
||
|
||
{{< tab header="Ruby" >}} | ||
|
||
# Navigate to URL | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -52,15 +52,12 @@ Selenium will return an [element click intercepted](https://w3c.github.io/webdri | |
# Click on the element | ||
driver.find_element(By.NAME, "color_input").click() | ||
{{< /tab >}} | ||
{{< tab header="CSharp" >}} | ||
|
||
// Navigate to Url | ||
driver.Navigate().GoToUrl("https://www.selenium.dev/selenium/web/inputs.html"); | ||
|
||
// Click the element | ||
driver.FindElement(By.Name("color_input")).Click(); | ||
|
||
|
||
{{< tab header="CSharp" text=true >}} | ||
{{< gh-codeblock path="examples/dotnet/SeleniumDocs/Elements/InteractionTest.cs#L17-L21" >}} | ||
{{< /tab >}} | ||
|
||
|
||
{{< tab header="Ruby" >}} | ||
|
||
# Navigate to URL | ||
|
@@ -113,20 +110,11 @@ possible keystrokes that WebDriver Supports. | |
driver.find_element(By.NAME, "email_input").send_keys("[email protected]" ) | ||
|
||
{{< /tab >}} | ||
{{< tab header="CSharp" >}} | ||
|
||
// Navigate to Url | ||
driver.Navigate().GoToUrl("https://www.selenium.dev/selenium/web/inputs.html"); | ||
|
||
// Clear field to empty it from any previous data | ||
driver.FindElement(By.Name("email_input")).Clear(); | ||
|
||
//Enter Text | ||
driver.FindElement(By.Name("email_input")).SendKeys("[email protected]"); | ||
|
||
|
||
} | ||
{{< tab header="CSharp" text=true >}} | ||
{{< gh-codeblock path="examples/dotnet/SeleniumDocs/Elements/InteractionTest.cs#L27-L33" >}} | ||
{{< /tab >}} | ||
|
||
{{< tab header="Ruby" >}} | ||
|
||
# Navigate to URL | ||
|
@@ -180,18 +168,12 @@ with a`content-editable` attribute. If these conditions are not met, | |
|
||
|
||
{{< /tab >}} | ||
{{< tab header="CSharp" >}} | ||
|
||
// Navigate to Url | ||
driver.Navigate().GoToUrl("https://www.selenium.dev/selenium/web/inputs.html"); | ||
|
||
// Clear field to empty it from any previous data | ||
driver.FindElement(By.Name("email_input")).Clear(); | ||
|
||
|
||
|
||
} | ||
{{< tab header="CSharp" text=true >}} | ||
{{< gh-codeblock path="examples/dotnet/SeleniumDocs/Elements/InteractionTest.cs#L40-L43" >}} | ||
{{< /tab >}} | ||
|
||
|
||
{{< tab header="Ruby" >}} | ||
|
||
# Navigate to URL | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -53,15 +53,11 @@ Selenium will return an [element click intercepted](https://w3c.github.io/webdri | |
# Click on the element | ||
driver.find_element(By.NAME, "color_input").click() | ||
{{< /tab >}} | ||
{{< tab header="CSharp" >}} | ||
|
||
// Navigate to Url | ||
driver.Navigate().GoToUrl("https://www.selenium.dev/selenium/web/inputs.html"); | ||
|
||
// Click the element | ||
driver.FindElement(By.Name("color_input")).Click(); | ||
|
||
{{< tab header="CSharp" text=true >}} | ||
{{< gh-codeblock path="examples/dotnet/SeleniumDocs/Elements/InteractionTest.cs#L17-L21" >}} | ||
{{< /tab >}} | ||
|
||
{{< tab header="Ruby" >}} | ||
|
||
# Navigate to URL | ||
|
@@ -115,20 +111,11 @@ possible keystrokes that WebDriver Supports. | |
driver.find_element(By.NAME, "email_input").send_keys("[email protected]" ) | ||
|
||
{{< /tab >}} | ||
{{< tab header="CSharp" >}} | ||
|
||
// Navigate to Url | ||
driver.Navigate().GoToUrl("https://www.selenium.dev/selenium/web/inputs.html"); | ||
|
||
// Clear field to empty it from any previous data | ||
driver.FindElement(By.Name("email_input")).Clear(); | ||
|
||
//Enter Text | ||
driver.FindElement(By.Name("email_input")).SendKeys("[email protected]"); | ||
|
||
|
||
} | ||
{{< tab header="CSharp" text=true >}} | ||
{{< gh-codeblock path="examples/dotnet/SeleniumDocs/Elements/InteractionTest.cs#L27-L33" >}} | ||
{{< /tab >}} | ||
|
||
{{< tab header="Ruby" >}} | ||
|
||
# Navigate to URL | ||
|
@@ -182,18 +169,11 @@ with a`content-editable` attribute. If these conditions are not met, | |
|
||
|
||
{{< /tab >}} | ||
{{< tab header="CSharp" >}} | ||
|
||
// Navigate to Url | ||
driver.Navigate().GoToUrl("https://www.selenium.dev/selenium/web/inputs.html"); | ||
|
||
// Clear field to empty it from any previous data | ||
driver.FindElement(By.Name("email_input")).Clear(); | ||
|
||
|
||
|
||
} | ||
{{< tab header="CSharp" text=true >}} | ||
{{< gh-codeblock path="examples/dotnet/SeleniumDocs/Elements/InteractionTest.cs#L40-L43" >}} | ||
{{< /tab >}} | ||
|
||
{{< tab header="Ruby" >}} | ||
|
||
# Navigate to URL | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -55,15 +55,11 @@ Selenium将返回一个 [元素点击中断](https://w3c.github.io/webdriver/#df | |
# Click on the element | ||
driver.find_element(By.NAME, "color_input").click() | ||
{{< /tab >}} | ||
{{< tab header="CSharp" >}} | ||
|
||
// Navigate to Url | ||
driver.Navigate().GoToUrl("https://www.selenium.dev/selenium/web/inputs.html"); | ||
|
||
// Click the element | ||
driver.FindElement(By.Name("color_input")).Click(); | ||
|
||
|
||
{{< tab header="CSharp" text=true >}} | ||
{{< gh-codeblock path="examples/dotnet/SeleniumDocs/Elements/InteractionTest.cs#L17-L21" >}} | ||
{{< /tab >}} | ||
|
||
{{< tab header="Ruby" >}} | ||
|
||
# Navigate to URL | ||
|
@@ -117,20 +113,12 @@ Selenium将返回一个 [元素点击中断](https://w3c.github.io/webdriver/#df | |
driver.find_element(By.NAME, "email_input").send_keys("[email protected]" ) | ||
|
||
{{< /tab >}} | ||
{{< tab header="CSharp" >}} | ||
|
||
// Navigate to Url | ||
driver.Navigate().GoToUrl("https://www.selenium.dev/selenium/web/inputs.html"); | ||
|
||
// Clear field to empty it from any previous data | ||
driver.FindElement(By.Name("email_input")).Clear(); | ||
|
||
//Enter Text | ||
driver.FindElement(By.Name("email_input")).SendKeys("[email protected]"); | ||
|
||
{{< tab header="CSharp" text=true >}} | ||
{{< gh-codeblock path="examples/dotnet/SeleniumDocs/Elements/InteractionTest.cs#L27-L33" >}} | ||
{{< /tab >}} | ||
|
||
|
||
} | ||
{{< /tab >}} | ||
{{< tab header="Ruby" >}} | ||
|
||
# Navigate to URL | ||
|
@@ -185,18 +173,11 @@ Selenium将返回一个 [元素点击中断](https://w3c.github.io/webdriver/#df | |
|
||
|
||
{{< /tab >}} | ||
{{< tab header="CSharp" >}} | ||
|
||
// Navigate to Url | ||
driver.Navigate().GoToUrl("https://www.selenium.dev/selenium/web/inputs.html"); | ||
|
||
// Clear field to empty it from any previous data | ||
driver.FindElement(By.Name("email_input")).Clear(); | ||
|
||
|
||
|
||
} | ||
{{< tab header="CSharp" text=true >}} | ||
{{< gh-codeblock path="examples/dotnet/SeleniumDocs/Elements/InteractionTest.cs#L40-L43" >}} | ||
{{< /tab >}} | ||
|
||
{{< tab header="Ruby" >}} | ||
|
||
# Navigate to URL | ||
|