Quantcast
Channel: Active questions tagged selenium - Stack Overflow
Viewing all articles
Browse latest Browse all 97917

How can I decide is there a specific text in web site withSelenium

$
0
0

EDITED POST

First of all, there is a similar question on site but it did not work that's why I am asking. I should decide is there a specific text LİSTELENECEK VERİ BULUNAMAMIŞTIR. on HTML code, there are only id attribute here is the HTML code:

<center id="genelUyariCenterTag">LİSTELENECEK VERİ BULUNAMAMIŞTIR.</center>

Here is the C# code:

 WebClient client = new WebClient();
void goMadde15Down() {
                    driver.FindElement(By.LinkText("İŞVEREN")).Click();
                    driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(10);
                    driver.FindElement(By.LinkText("TEŞVİKLER VE TANIMLAR")).Click();
                    driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(10);
                    driver.FindElement(By.LinkText("4447/GEÇİCİ 15. MADDE LİSTELEME/SİLME")).Click();
                    driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(10);
                    string siteSource15 = client.DownloadString("https://uyg.sgk.gov.tr/IsverenSistemi");

                    string strText = driver.FindElement(By.XPath("//center[@id='genelUyariCenterTag' and contains(.,'BULUNAMAMIŞTIR')]")).Text;

                    if (strText.Contains("LİSTELENECEK VERİ BULUNAMAMIŞTIR."))
                    {
                        Console.WriteLine("madde15 there is no Excel");
                    }
                    else
                    {
                        Console.WriteLine("madde 15 there is an Excel");
                    }

The problem is, the condition always converge to else clause


Viewing all articles
Browse latest Browse all 97917

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>