I want to download an Excel file on the web site, but I think i did something wrong. I have HTML code:
<label class="pager">
<input onclick="excelForm.submit()" type="image" value="Excel" src="/YeniSistem/images/Excel_Document_Icon.png">
</label>
What I want to do this with using Selenium I want to click that input with using C#. I have tried in many ways, like:
driver.FindElement(By.XPath(".//html/body/div/div/table/tbody/tr[2]/td/table/tbody/tr[2]/td[2]/div/div/label[2]/input")).Click();
and:
driver.FindElements(By.XPath(".//div[@id='contentContainer']/div/table/tbody/tr[2]/td/table/tbody/tr[2]")).Click();
and:
driver.FindElements(By.XPath(".//input[contains(@value , 'Excel')]")).Click();
Also I tried previous codes without . in frond of XPath. Please help me to resolve this.
OpenQA.Selenium.NoSuchElementException: 'no such element: Unable to locate element: {"method":"xpath","selector":".//html/body/div/div/table/tbody/tr[2]/td/table/tbody/tr[2]/td[2]/div/div/label[2]/input"} (Session info: chrome=79.0.3945.130)'.//label[@class='pager']/input?