C# Selenium enter menu

Asked

Viewed 90 times

-1

I am automating access to a site, it opens browser, logs in, goes to a certain page and after that, a drop-down list appears to choose "Category" Inside this drop-down list, I have 3 items only, it gets to open the drop-down list no more click or enter.

        public void DropDown()
    {
        driver.FindElement(By.XPath("/html/body/div[3]/div[2]/table/tbody/tr[1]/td[1]")).Click();
    }

I have tried with Name, Tagname, Value, Id, Class, unsuccessful.

<table class="MenuTable" style="width: 123px;" cellspacing="0" cellpadding="0"><tbody class="MenuTableBody"><tr class="MenuTableRow"><td class="MenuEntryNameHover" nowrap="">Criado por Mim</td><td class="MenuEntryNoSubHover" arvalue="Criado por Mim"></td></tr><tr class="MenuTableRow"><td class="MenuEntryName" nowrap="">Todos os Relatórios</td><td class="MenuEntryNoSub" arvalue="Todos os Relatórios"></td></tr><tr class="MenuTableRow"><td class="MenuEntryName" nowrap="">(Limpar)</td><td class="MenuEntryNoSub" arvalue=""></td></tr></tbody></table>

and the Xpath I have when, detail I’m new to programming and still don’t know much about Xpath

/html/body/div[3]/div[2]/table/tbody/tr[1]/td[2]

This value is passed me by Browser copying Xpath

1 answer

0


I resolved so.

        driver.FindElement(By.ClassName("selection")).Click();
        driver.FindElement(By.Id("arid_WIN_0_93210")).SendKeys(Keys.Down);
        driver.FindElement(By.Id("arid_WIN_0_93210")).SendKeys(Keys.Enter);

Browser other questions tagged

You are not signed in. Login or sign up in order to post.