我在输入代码的xpath无法读取时遇到问题。 xpath有问题

时间:2019-05-27 20:11:10

标签: c# selenium google-chrome selenium-webdriver xpath

它向我显示此错误

" OpenQA.Selenium.ElementClickInterceptedException: "element click intercepted: Element <span class=\"_1vp5\">...</span> is not clickable at point (759, 21). Other element would receive the click: <div class=\"_3ixn\"></div>\n  (Session info: chrome=74.0.3729.169)\n  (Driver info: chromedriver=74.0.3729.6 (255758eccf3d244491b8a1317aa76e1ce10d57e9-refs/branch-heads/3729@{#29}),platform=Mac OS X 10.14.1 x86_64)"

在代码中,使用我的ID的工作(不是我的电子邮件和密码)登录,但是xpath方法不起作用.xpath到我的个人资料页面,其中没有ID与之关联。它告诉我上面的错误。

你们还有其他方法可以使用xpath吗?

using System;
using OpenQA.Selenium;
using OpenQA.Selenium.Chrome;
using System.Threading;


namespace lettryanotherone
{
    class EntryPoint
    {
        static void Main(string[] args)
        {

            IWebDriver ChromeDriver = new ChromeDriver(Environment.CurrentDirectory);

            ChromeDriver.Navigate().GoToUrl("https://www.facebook.com");

            ChromeDriver.FindElement(By.Id("email")).SendKeys("brother@hotmail.com");
            ChromeDriver.FindElement(By.Id("pass")).SendKeys("1234567" + Keys.Enter);
            ChromeDriver.FindElement(By.XPath("//*[@id=\"u_0_a\"]/div[1]/div[1]/div/a/span/span")).Click();

        }
    }
}

0 个答案:

没有答案