FindElementByName() public method

Finds the first of elements that match the name supplied
public FindElementByName ( string name ) : IWebElement
name string Name of the element on the page
return IWebElement
示例#1
0
        private void xmpp_OnLogin(object sender)
        {
            if (Connected != null)
                Connected(this, EventArgs.Empty);
            //Notifico a tutti la mia presenza
            Presence p = new Presence(ShowType.chat, "Online");
            p.Type = PresenceType.available;
            xmpp.Send(p);
            xmpp.OnMessage += new MessageHandler(xmpp_OnMessage);

            //Mono.Zeroconf.RegisterService rs = new Mono.Zeroconf.RegisterService();
            //rs.Name = "_signage_client";
            //rs.Port = 80;
            //rs.RegType = "_tcp";
            //rs.Register();

            xmpp.Send(new Message("[email protected]/Aramis", "test"));

            ProcessStartInfo chromedriver = new ProcessStartInfo("chromedriver.exe");
            chromedriver.CreateNoWindow = true;
            chromedriverprocess = Process.Start(chromedriver);

            DesiredCapabilities capability = DesiredCapabilities.Chrome();
            capability.SetCapability("chrome.binary", "chrome-win32\\chrome.exe");
            capability.SetCapability("chrome.switches", new List<String>() { "--kiosk", "--disable-translate", "--allow-outdated-plugins", "--profile-directory profiles" }.ToArray());
            wd = new RemoteWebDriver(new System.Uri("http://localhost:9515/"), capability);
            wd.Navigate().GoToUrl("http://www.google.com/");

            wd.FindElementByName("q").SendKeys("prova");
        }