c#IWebDriver - 帮我点击“Đăngnhập”(“Đăngnhập”=“登录”)

时间:2016-03-16 05:39:09

标签: c# selenium-chromedriver

我尝试了在谷歌中找到的任何东西,但所有不能使用

public Form1()
    {
        InitializeComponent();
    }IWebDriver driver;
    private void Form1_Load(object sender, EventArgs e)
    {
        driver = new ChromeDriver();
        driver.Navigate().GoToUrl("http://idol.talktv.vn/");
    }

    private void button1_Click(object sender, EventArgs e)
    {
        //help me some code
    }

<div class="no-login" style="" id="noLoginBox"> <a style="float:left" href="javascript:void(0);"></a><a href="javascript:void(0);" onclick="LoginLogicManagement.showForm();" class="dl"><font><font class="">Đăng nhập </font></font></a>&nbsp;&nbsp;<span style="color: #CACACA"><font><font class="">| </font></font></span>&nbsp;&nbsp;<a href="https://id.zing.vn/v2/register" target="_blank" class="zc" style="cursor: pointer;"><font><font class="">Đăng ký </font></font></a>&nbsp;&nbsp;&nbsp;&nbsp;</div>

and a pic for easy look

1 个答案:

答案 0 :(得分:0)

通过XPath定位元素。然后点击它。 (右键单击Chrome,检查,右键单击Đăngnhập并复制XPath。

然后:

driver.FindElement(By.XPath ......点击();

祝你好运