Thursday, January 31, 2019

How to clear text from textarea using selenium c# driver?

Declare the web element. Let say 'desc'

Various methods are:
1.         desc.SendKeys(Keys.Control + "a");
            desc.SendKeys(Keys.Delete);

2.            desc.Clear();

Sunday, December 30, 2018

How to test an autocomplete address in Selenium C# driver?

 //Define Search Address
        [FindsBy(How = How.Id, Using = "autocomplete")]
        private IWebElement SearchAddress { get; set; }

// Send value in Search Address
SearchAddress.SendKeys("223 Mount Eden Road, Mount Eden, Auckland");
            Thread.Sleep(1000);
            SearchAddress.SendKeys(Keys.Down);
            SearchAddress.SendKeys(Keys.Enter);

Tuesday, November 20, 2018

How to create your own XPath

There are two types of XPaths: Absolute and Relative

Absolute XPath: starts with single "/" i.e. start with the root node.

Relative XPath: starts with double "//".

Tuesday, November 13, 2018

Uploading an image using AutoIT in selenium c# driver

//Creating an object
AutoItX3Lib.AutoItX3 autoIt = new AutoItX3();

//Mention the name of the active/opened window
            autoIt.WinActivate("Open");
//Path of the image /file to upload
            autoIt.Send("C:\\Users\\Dell\\Documents\\image1.jpg\\");  //Use double back slash
            Thread.Sleep(600);
            autoIt.Send("{Enter}");