Rediff link text is not displaying - another way | Selenium C# Forum
S
shobha bandaru Posted on 14/12/2018
Hi Gunjan Ji,

Itried  in  a differentway  ..this  is  alsonotworking

using OpenQA.Selenium;
using OpenQA.Selenium.Chrome;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp1
{
class rediff2
{
public static void Main(string[] args)
{
IWebDriver driver = new ChromeDriver(@"C:\Users\sbandaru\Desktop\example\Drivers");

driver.Navigate().GoToUrl("http://shopping.rediff.com/?sc_cid=ushome_icon");

IWebElement outerbox = driver.FindElement(By.XPath("//*[@id='popular_cat']"));

if (Exists(outerbox))
{
Console.WriteLine("Outerbox is correct");

}

IList<IWebElement> list = outerbox.FindElements(By.TagName("a"));

Console.WriteLine(list.Count);

foreach (IWebElement res in list)
{
Console.WriteLine("link name:" + "" + res.Text.ToString());
}

Console.ReadKey();

}

public static bool Exists(IWebElement element)
{
if (element == null)
{
return false;

}
return true;
}
}
}

G
gunjan Replied on 14/12/2018

On my end, this code is also running fine. Please try again.