0

I have following html page generated dyamically in vb.net app <td class="GridCellRightAlign" role = "gridcell" aria-describedBy = "grdFromActInfo_colheader_2"> 0.00 </td> I am using C# with Selenium WebDriver to sendkeys in this field using xpath. But it does not work. The C# Selenium code is as follows By.XPath("//*[@id'grdFromActInfo']/table/tbody/tr[1]/td[1]/table/tbody[2]/tr/td/div[2]/table/tbody/tr/th).SendKeys("25"). I generated this xpath in Chrome Dev Tools using Inspect option

Sudhir Jangam
  • 646
  • 2
  • 13
  • 20

1 Answers1

0
var element = driver.FindElement(By.XPath("//*[@id'grdFromActInfo']/table/tbody/tr[1]/td[1]/table/tbody[2]/tr/td/div[2]/table/tbody/tr/th");
element.SendKeys("25");
Dharman
  • 30,962
  • 25
  • 85
  • 135
Ukrainis
  • 534
  • 2
  • 16
  • This still does not work. The sendkeys does not do anything, it moves to the next statement. It looks like Sendkeys only works for input html tag. Not sure if this has something to do with gridCell role – Sudhir Jangam Mar 17 '20 at 12:41
  • Maybe your selector is not correct. Verify it. I think, there should be some kind of Input element. – Ukrainis Mar 17 '20 at 13:39
  • I found that the application I am trying to automate using Selenium, is using Infragistic's WebDataGrid control. They have Javascript library at [link] https://www.infragistics.com/help/aspnet/webdatagrid~infragistics.web.ui_namespace. The gridcell is one of the object provided by the API – Sudhir Jangam Mar 17 '20 at 19:14
  • I was able to resolve the issue with Selenium+Javascript with below code string col2set = "$find('grdFromActInfo').get_rows().get_row(0).get_cell(2).set_value(22) js.ExecuteScript(col2set) But the screen is not reflecting the value – Sudhir Jangam Mar 17 '20 at 23:34