mercredi 24 novembre 2021

OpenQA.Selenium.NoSuchElementException: 'no such element: Unable to locate element: c#

i can't click on one item. It seemed to me that everything was fine, but no, no. Anyone have any idea what could be wrong? i have tried a lot of xpath and nothing - still the same, please help...............................................................................

using OpenQA.Selenium;
using OpenQA.Selenium.Chrome;
using OpenQA.Selenium.Interactions;


namespace Char
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        
        ChromeDriver driver;
        Thread th;

        private void Form1_Load(object sender, EventArgs e)
        {
            ChromeOptions options = new ChromeOptions();
            options.AddArguments("--disable-notifications");
            driver = new ChromeDriver(options);
          
        }

        private void button1_Click(object sender, EventArgs e)
        {
            string url = textBox1.Text;
            driver.Navigate().GoToUrl(url); Thread.Sleep(2000);

            driver.FindElement(By.XPath("//button[@id='onetrust-accept-btn-handler']")).Click(); Thread.Sleep(3000);

            driver.FindElement(By.XPath("//a[normalize-space()='Mój OLX']")).Click(); Thread.Sleep(2000); 

            driver.FindElement(By.XPath("//section[@class='login-page has-animation']//input[@id='userEmail']")).SendKeys("anastazja.bendkowska@wp.pl"); Thread.Sleep(3000);

            driver.FindElement(By.XPath("//input[@id='userPass']")).SendKeys("Anastazja12345");

            driver.FindElement(By.XPath("//section[@class='login-page has-animation']//button[@id='se_userLogin']")).Click(); Thread.Sleep(3000);

            WebElement ele = (WebElement)driver.FindElement(By.XPath("//div[@class='css-1povu0j']"));
            Actions action = new Actions(driver);
            action.MoveToElement(ele).Perform(); Thread.Sleep(5000);

            driver.FindElement(By.XPath("//span[contains(text(),'Wyloguj')]")).Click();
            //driver.FindElement(By.XPath("")).Click();


        }
    }
}



Aucun commentaire:

Enregistrer un commentaire