- Популярные видео
- Авто
- Видео-блоги
- ДТП, аварии
- Для маленьких
- Еда, напитки
- Животные
- Закон и право
- Знаменитости
- Игры
- Искусство
- Комедии
- Красота, мода
- Кулинария, рецепты
- Люди
- Мото
- Музыка
- Мультфильмы
- Наука, технологии
- Новости
- Образование
- Политика
- Праздники
- Приколы
- Природа
- Происшествия
- Путешествия
- Развлечения
- Ржач
- Семья
- Сериалы
- Спорт
- Стиль жизни
- ТВ передачи
- Танцы
- Технологии
- Товары
- Ужасы
- Фильмы
- Шоу-бизнес
- Юмор
Selenium with C# 35 - Synchronization using Thread.Sleep and implicit wait explained in detail
Synchronization in selenium using Thread.Sleep and implicit wait explained in detail.
Like our facebook page www.facebook.com/ankprotraining
Synchronization
Thread Sleep method
Implicit Wait
What is Synchronization in selenium?
Process of matching automation tool speed with application tool speed is called synchronization.
Whenever Webdriver try to perform action on the element is not loaded in UI or application, in such cases Webdriver throws ‘No such element exception’ and stops the execution because of the synchronization issue.
Thread Sleep method :
Thread Wait causes the currently executing thread to sleep for the specified number of milliseconds.
It always waits for specified amount of time, even though element is available early.
It is also called hard coded wait.
Usage: Thread.Sleep(2000)
Avoid using Thread.Sleep method in the production code.
What is Implicit Wait in selenium?
On implementing implicit wait, if WebDriver cannot find an element in the Document Object Model(DOM), it will wait for a defined amount of time for the element to appear in the DOM
Driver will look for the element by polling every 500 milli second
Driver will wait specified amount time or element is available in the DOM
If the element is not available even after the specified time, driver will throw ElementNotFound exception
Usage: driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(20);
Possible Interview Questions on selenium synchronization using implicit wait and thread.sleep :
What is Synchronization?
What is Thread.Sleep wait?
What is implicit wait?
What is the difference between Thread.Sleep And ImplicitWait?
Code :
[TestClass]
public class Synchronization
{
[TestMethod]
public void SynchronizationUsingSleep()
{
IWebDriver driver = new FirefoxDriver();
driver.Url = "http://uitestpractice.com/Students/Contact";
driver.FindElement(By.PartialLinkText("This is")).Click();
Thread.Sleep(12000);
string result = driver.FindElement(By.ClassName("ContactUs")).Text;
Console.WriteLine(result);
Assert.IsTrue(result.Contains("Python"));
Thread.Sleep(1000);
driver.Quit();
}
[TestMethod]
public void SynchronizationUsingImplicitWait()
{
IWebDriver driver = new FirefoxDriver();
driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(3);
driver.Url = "http://uitestpractice.com/Students/Contact";
driver.FindElement(By.PartialLinkText("This is")).Click();
//Thread.Sleep(12000);
string result = driver.FindElement(By.ClassName("ContactUs")).Text;
Assert.IsTrue(result.Contains("Python"));
driver.Quit();
}
Видео Selenium with C# 35 - Synchronization using Thread.Sleep and implicit wait explained in detail канала Ankpro Training
Like our facebook page www.facebook.com/ankprotraining
Synchronization
Thread Sleep method
Implicit Wait
What is Synchronization in selenium?
Process of matching automation tool speed with application tool speed is called synchronization.
Whenever Webdriver try to perform action on the element is not loaded in UI or application, in such cases Webdriver throws ‘No such element exception’ and stops the execution because of the synchronization issue.
Thread Sleep method :
Thread Wait causes the currently executing thread to sleep for the specified number of milliseconds.
It always waits for specified amount of time, even though element is available early.
It is also called hard coded wait.
Usage: Thread.Sleep(2000)
Avoid using Thread.Sleep method in the production code.
What is Implicit Wait in selenium?
On implementing implicit wait, if WebDriver cannot find an element in the Document Object Model(DOM), it will wait for a defined amount of time for the element to appear in the DOM
Driver will look for the element by polling every 500 milli second
Driver will wait specified amount time or element is available in the DOM
If the element is not available even after the specified time, driver will throw ElementNotFound exception
Usage: driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(20);
Possible Interview Questions on selenium synchronization using implicit wait and thread.sleep :
What is Synchronization?
What is Thread.Sleep wait?
What is implicit wait?
What is the difference between Thread.Sleep And ImplicitWait?
Code :
[TestClass]
public class Synchronization
{
[TestMethod]
public void SynchronizationUsingSleep()
{
IWebDriver driver = new FirefoxDriver();
driver.Url = "http://uitestpractice.com/Students/Contact";
driver.FindElement(By.PartialLinkText("This is")).Click();
Thread.Sleep(12000);
string result = driver.FindElement(By.ClassName("ContactUs")).Text;
Console.WriteLine(result);
Assert.IsTrue(result.Contains("Python"));
Thread.Sleep(1000);
driver.Quit();
}
[TestMethod]
public void SynchronizationUsingImplicitWait()
{
IWebDriver driver = new FirefoxDriver();
driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(3);
driver.Url = "http://uitestpractice.com/Students/Contact";
driver.FindElement(By.PartialLinkText("This is")).Click();
//Thread.Sleep(12000);
string result = driver.FindElement(By.ClassName("ContactUs")).Text;
Assert.IsTrue(result.Contains("Python"));
driver.Quit();
}
Видео Selenium with C# 35 - Synchronization using Thread.Sleep and implicit wait explained in detail канала Ankpro Training
implicit wait in selenium webdriver implicit wait synchronization in selenium c# synchronization in selenium webdriver synchronization in selenium thread.sleep c# thread.sleep Thread.Sleep in selenium Thread Sleep method What is Synchronization in selenium What is Implicit Wait in selenium What is Implicit Wait difference between Thread.Sleep And ImplicitWait selenium advanced selenium advanced concepts selenium c# ankpro C#
Комментарии отсутствуют
Информация о видео
10 июля 2018 г. 20:32:34
00:11:12
Другие видео канала





















