jeudi 22 septembre 2016

selenium c# instance of an object error

there selenium web drive c # but I create the code in the "Object reference not set to an instance of an object" error How was I supposed to regular code? Can you help please?

    private void Modul4_Siteimage()
    {        
        try
        {
            IWebDriver driver = webDriverSelect(comboBox_Browser.Text); //browser seçilir                   


            for (int i = 0; i < lst_Result.Items.Count; i++)
            {

                driver.Navigate().GoToUrl(lst_Result.Items[i+1].ToString()); //link seçilir


                foreach (var item in driver.FindElements(By.ClassName("lazyOwl")))
                {
                    MessageBox.Show(driver.FindElements(By.ClassName("lazyOwl")).Count.ToString());
                    MessageBox.Show(item.GetAttribute("src").ToString());
                    if (doesImageExistRemotely(item.GetAttribute("src").ToString(), "image/jpeg"))
                        {
                            lst_Result.Items.Add("Doğru " + lst_Result.Items[i].ToString());
                        }
                        else
                        {
                            lst_Result.Items.Add("HATA " + lst_Result.Items[i].ToString());
                        }

                }

            }
            driver.Close();

        }
        catch (Exception exx)
        {
            MessageBox.Show("Hata " + exx.Message);
        }

    }

Aucun commentaire:

Enregistrer un commentaire