How to write exception and does not consider when it meet specific element using selenium in java -


i tried extract webpage. got xpath following.

/html/body/form/div[2]/div[2]/div/div[3]/div[1]/div[11]/div[1]/table /html/body/form/div[2]/div[2]/div/div[3]/div[1]/div[11]/div[2]/table /html/body/form/div[2]/div[2]/div/div[3]/div[1]/div[11]/div[4]/table. 

i tried code.

for(int k=1;k<=4;k++){     webelement e=driver.findelement(by.xpath("/html/body/form/div[2]/div[2]/div/div[3]/div[1]/div[11]/div["+k+"]"));     for(int i=1;i<=4;i++){         webelement e1=e.findelement(by.xpath("/html/body/form/div[2]/div[2]/div/div[3]/div[1]/div[11]/div["+k+"]/table/tbody/tr/td/table/tbody/tr["+i+"]"));         for(int j=1;j<=2;j++){             webelement e2=e.findelement(by.xpath("/html/body/form/div[2]/div[2]/div/div[3]/div[1]/div[11]/div["+k+"]/table/tbody/tr/td/table/tbody/tr["+i+"]")); } } } 

it shows errors following.

could not find element /html/body/form/div[2]/div[2]/div/div[3]/div[1]/div[11]/div[3]/table

how can write exception code?


Comments

Popular posts from this blog

ios - MKAnnotationView layer is not of expected type: MKLayer -

ZeroMQ on Windows, with Qt Creator -

unity3d - Unity SceneManager.LoadScene quits application -