0
votes

The URL of website is http://www.mca.gov.in/mcafoportal/viewCompanyMasterData.do and when I click the Search icon beside Company/LLP Name it opens an overlay with a text input to enter the company name, but the element is not visible in Selenium Webdriver C# Here's the Screenshot of the wepPage Below is the HTML code for Text Field

<input type="text" size="40" id="searchcompanyname" name="searchcompanyname" onkeydown="javascript: if (event.keyCode==13) return fetchCINData();">

and here's my C# code

IWebDriver chrome = new ChromeDriver("C:\\");
        chrome.Navigate().GoToUrl("http://www.mca.gov.in/mcafoportal/viewCompanyMasterData.do");
        chrome.FindElement(By.XPath(".//*[@id='imgSearchIcon']")).Click();
        bool a = chrome.FindElement(By.CssSelector("input[type=text][name='searchcompanyname']")).Displayed;
        MessageBox.Show(""+a,"");
1

1 Answers

1
votes

When you click the search icon it takes +1 seconds for the form and the search input to get displayed, But in your code you're checking the element right after clicking the search icon which will take just a couple of milliseconds. So you need to wait before doing that, maybe using Thread.Sleep(2000); Or better keep checking if the element is displayed each -maybe- 500 ms.