Interakce With Web Test NUnit Visual Studio 2022
This commit is contained in:
		
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							@@ -6,6 +6,7 @@ using System.Linq;
 | 
			
		||||
using System.Text;
 | 
			
		||||
using System.Threading.Tasks;
 | 
			
		||||
using OpenQA.Selenium.Interactions;
 | 
			
		||||
using OpenQA.Selenium.Support.UI;
 | 
			
		||||
 | 
			
		||||
namespace SeleniumNunitProject.Tests
 | 
			
		||||
{
 | 
			
		||||
@@ -21,32 +22,57 @@ namespace SeleniumNunitProject.Tests
 | 
			
		||||
 | 
			
		||||
            // click  default checkbox
 | 
			
		||||
            driver.FindElement(By.Id("my-check-2")).Click();
 | 
			
		||||
            Thread.Sleep(2000);
 | 
			
		||||
 | 
			
		||||
            // click radio button
 | 
			
		||||
            driver.FindElement(By.Id("my-radio-2")).Click();
 | 
			
		||||
            Thread.Sleep(2000);
 | 
			
		||||
 | 
			
		||||
            // right click
 | 
			
		||||
            var actions = new Actions(driver);
 | 
			
		||||
            var button = driver.FindElement(By.TagName("button"));
 | 
			
		||||
            actions.ContextClick(button).Perform();
 | 
			
		||||
            Thread.Sleep(2000);
 | 
			
		||||
 | 
			
		||||
            // double click
 | 
			
		||||
            var checkbox1 = driver.FindElement(By.Id("my-check-1"));
 | 
			
		||||
            actions.DoubleClick(checkbox1).Perform();
 | 
			
		||||
            Thread.Sleep(2000);
 | 
			
		||||
 | 
			
		||||
            // sendkeys input
 | 
			
		||||
            driver.FindElement(By.Id("my-text-id")).SendKeys(Guid.NewGuid().ToString());
 | 
			
		||||
            Thread.Sleep(2000);
 | 
			
		||||
 | 
			
		||||
            // text area
 | 
			
		||||
            var textArea = driver.FindElement(By.Name("my-textarea"));
 | 
			
		||||
            textArea.SendKeys(Guid.NewGuid().ToString());
 | 
			
		||||
            Thread.Sleep(2000);
 | 
			
		||||
 | 
			
		||||
            // clear
 | 
			
		||||
            //textArea.Clear();
 | 
			
		||||
            textArea.Clear();
 | 
			
		||||
            Thread.Sleep(2000);
 | 
			
		||||
 | 
			
		||||
            // select Dropdown (select)
 | 
			
		||||
            // rozbalovací menu
 | 
			
		||||
            var selectElement = driver.FindElement(By.Name("my-select"));
 | 
			
		||||
            var select = new SelectElement(selectElement);
 | 
			
		||||
 | 
			
		||||
            select.SelectByText("One");
 | 
			
		||||
            select.SelectByValue("2");
 | 
			
		||||
            select.SelectByIndex(3);
 | 
			
		||||
            Thread.Sleep(2000);
 | 
			
		||||
 | 
			
		||||
            // upload
 | 
			
		||||
            var filePath = Path.GetTempPath() + Guid.NewGuid().ToString() + ".txt";
 | 
			
		||||
            File.WriteAllText(filePath, Guid.NewGuid().ToString());
 | 
			
		||||
            driver.FindElement(By.Name("my-file")).SendKeys(filePath);
 | 
			
		||||
            Thread.Sleep(2000);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
           //driver.Quit();
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
            driver.Quit();
 | 
			
		||||
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							@@ -1 +1 @@
 | 
			
		||||
2006750491
 | 
			
		||||
603377410
 | 
			
		||||
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
		Reference in New Issue
	
	Block a user