1

I am using the C# selenium, Specflow and Nunit3 for performing above task. I am confused that how to validate the page. Later on, following task already i have done. Moreover, it Search for the link of Behavior driven development and navigates there.

Steps:

  1. Navigate to the [Wikipedia][1] site.
  2. Choose the English language
  3. Search for "Test Automation”

[TestFixture]
public class ChromeTesting : Hooks
{
    [Test]
    public void ChromeWikipediaTest()
    {
        //1-  Navigate to the Wikipedia site
        Driver.Navigate().GoToUrl("https://www.wikipedia.org");

          //2- Get the search results panel that contains the link for each result.
          Driver.FindElement(By.Name("search")).SendKeys("Test Automation");


            Driver.FindElement(By.Name("go")).Click();
           Assert.That(Driver.PageSource.Contains("Test Automation"), Is.EqualTo(true),
                                                     "Test Automation Does not Exits");

    }
}}
4
  • 1
    What you tried so far? Source code? Errors? Apr 20, 2018 at 13:38
  • I'm voting to close this as it's unclear what you're asking. It stuns me how many posts are made on this stack, by testers, without enough information in them. Testing 101 - there's (almost) no such thing as too much detail.
    – dvniel
    Apr 20, 2018 at 14:01
  • @theonlydanever I am performing a task that: *Navigate to the Wikipedia site. *Choose the English language *Search for "Test Automation”. I have done till here. Now I need to validate the following in this page: 1- Unit testing text and 2- Existence of Test Automation Interface Model picture 3- Search for the link of Behavior driven development and navigate to there. I am using C# Selenium, Specflow for BDD, Nunit 3 for performing all above task. Apr 20, 2018 at 14:22
  • @PeterMasiar I have done this so far . I needed to validate the pages: i.e. unit testing text and Existence of Test Automation Interface Model picture also this search for the link of Behavior driven development and navigate to there. Apr 20, 2018 at 14:32

1 Answer 1

0

the below are in java/selenium.

  1. Unit Testing word presents

    List p = driver.findElements(By.tagName("P")); for(WebElement e:p) { if(e.getText().contains("unit testing")) { System.out.println("Present"); } }

    1. Test Automation Interface Model picture

    if(driver.findElement(By.xpath(".//*[@id='mw-content-text']/div/div[4]/div/a/img")).isDisplayed()) { System.out.println("Present"); }

    1. Link Click

    List G = driver.findElements(By.tagName("a")); for(WebElement d:G) { if (d.getText().contains("Behavior driven development")) { driver.get(d.getAttribute("href")); } }

1
  • Thanks for your guidance which helps me a bit but i want to have it in C#. Apr 21, 2018 at 10:54

Not the answer you're looking for? Browse other questions tagged or ask your own question.