How to use DropdownPage method of Ocaramba.Tests.NUnitExtentReports.PageObjects.DropdownPage class

Best Ocaramba code snippet using Ocaramba.Tests.NUnitExtentReports.PageObjects.DropdownPage.DropdownPage

InternetPage.cs

Source:InternetPage.cs Github

copy

Full Screen

...62 Logger.Info(CultureInfo.CurrentCulture, "Opening page {0}", url);63 ExtentTestLogger.Debug("InternetPage: Opening page: " + url);64 return this;65 }66 public DropdownPage GoToDropdownPage()67 {68 ExtentTestLogger.Debug("InternetPage: Opening Dropdown page");69 this.Driver.GetElement(this.linkLocator.Format("dropdown")).Click();70 return new DropdownPage(this.DriverContext);71 }72 public MultipleWindowsPage GoToMultipleWindowsPage()73 {74 ExtentTestLogger.Debug("InternetPage: Opening Multiple Windows page");75 this.Driver.GetElement(this.linkLocator.Format("windows")).Click();76 return new MultipleWindowsPage(this.DriverContext);77 }78 public BasicAuthPage GoToBasicAuthPage()79 {80 ExtentTestLogger.Debug("InternetPage: Opening Basic Auth Page");81 this.Driver.GetElement(this.linkLocator.Format("basic_auth")).Click();82 return new BasicAuthPage(this.DriverContext);83 }84 public NestedFramesPage GoToNestedFramesPage()...

Full Screen

Full Screen

DropdownPage.cs

Source:DropdownPage.cs Github

copy

Full Screen

1// <copyright file="DropdownPage.cs" company="Objectivity Bespoke Software Specialists">2// Copyright (c) Objectivity Bespoke Software Specialists. All rights reserved.3// </copyright>4// <license>5// The MIT License (MIT)6// Permission is hereby granted, free of charge, to any person obtaining a copy7// of this software and associated documentation files (the "Software"), to deal8// in the Software without restriction, including without limitation the rights9// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell10// copies of the Software, and to permit persons to whom the Software is11// furnished to do so, subject to the following conditions:12// The above copyright notice and this permission notice shall be included in all13// copies or substantial portions of the Software.14// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR15// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,16// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE17// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER18// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,19// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE20// SOFTWARE.21// </license>22namespace Ocaramba.Tests.NUnitExtentReports.PageObjects23{24 using Ocaramba;25 using Ocaramba.Extensions;26 using Ocaramba.Tests.NUnitExtentReports.ExtentLogger;27 using Ocaramba.Tests.PageObjects;28 using Ocaramba.Types;29 using Ocaramba.WebElements;30 public class DropdownPage : ProjectPageBase31 {32 private readonly ElementLocator dropDownLocator = new ElementLocator(33 Locator.Id, "dropdown");34 public DropdownPage(DriverContext driverContext)35 : base(driverContext)36 {37 }38 39 public void SelectByIndex(int index)40 {41 ExtentTestLogger.Debug("DropdownPage: Selecting element on dropdown by index: " + index);42 Select select = this.Driver.GetElement<Select>(this.dropDownLocator, 300);43 select.SelectByIndex(index);44 }45 public void SelectByValue(string value)46 {47 ExtentTestLogger.Debug("DropdownPage: Selecting element on dropdown by value: " + value);48 Select select = this.Driver.GetElement<Select>(this.dropDownLocator, 300);49 select.SelectByValue(value);50 }51 public void SelectByText(string text, int timeout)52 {53 ExtentTestLogger.Debug("DropdownPage: Selecting element on dropdown by visible text: " + text);54 Select select = this.Driver.GetElement<Select>(this.dropDownLocator);55 select.SelectByText(text, timeout);56 }57 public string SelectedOption()58 {59 ExtentTestLogger.Debug("DropdownPage: Getting selected option");60 Select select = this.Driver.GetElement<Select>(this.dropDownLocator);61 return select.SelectElement().SelectedOption.Text;62 }63 }64}...

Full Screen

Full Screen

SelectWebElementTests.cs

Source:SelectWebElementTests.cs Github

copy

Full Screen

...15 {16 const string ExpectedOption = "Option 1";17 var dropdownPage = new InternetPage(this.DriverContext)18 .OpenHomePage()19 .GoToDropdownPage();20 dropdownPage.SelectByIndex(1);21 Assert.AreEqual(dropdownPage.SelectedOption(), ExpectedOption);22 test.Info("Verifying selected option, expected: " + ExpectedOption);23 }24 [Test]25 public void NoSuchElementExceptionByTextTest()26 {27 const string ElementText = "Qwerty.";28 var dropdownPage = new InternetPage(this.DriverContext)29 .OpenHomePage()30 .GoToDropdownPage();31 Assert.That(() => dropdownPage.SelectByText(ElementText, 10), Throws.Nothing);32 test.Info("Verifying it's possible to select element on dropdown by text: " + ElementText);33 }34 [Test]35 public void NoSuchElementExceptionByIndexTest()36 {37 const int ElementIndex = 7;38 var dropdownPage = new InternetPage(this.DriverContext)39 .OpenHomePage()40 .GoToDropdownPage();41 Assert.That(() => dropdownPage.SelectByIndex(ElementIndex), Throws.Nothing);42 test.Info("Verifying it's possible to select element on dropdown by element index: " + ElementIndex.ToString());43 }44 [Test]45 public void NoSuchElementExceptionByValueTest()46 {47 const string ElementValue = "qwerty";48 var dropdownPage = new InternetPage(this.DriverContext)49 .OpenHomePage()50 .GoToDropdownPage();51 Assert.That(() => dropdownPage.SelectByValue(ElementValue), Throws.Nothing);52 test.Info("Verifying it's possible to select element on dropdown by value: " + ElementValue);53 }54 }55}...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run Ocaramba automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful