selenium c# instance of an object error -


there selenium web drive c # create code in "object reference not set instance of object" error how supposed regular code? can please?

    private void modul4_siteimage()     {                 try         {             iwebdriver driver = webdriverselect(combobox_browser.text); //browser seçilir                                  (int = 0; < 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")))                 {                      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);         }      } 

you trying access .tostring() of null last iteration of loop driver.navigate().gotourl(lst_result.items[i+1].tostring());. may change loop as:

for (int = 0; < lst_result.items.count-1; i++) {     ... } 

Comments

Popular posts from this blog

unity3d - Rotate an object to face an opposite direction -

angular - Is it possible to get native element for formControl? -

javascript - Why jQuery Select box change event is now working? -