Element not found exception while executing the script

classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

Element not found exception while executing the script

Shweta Choubey
Hi All,

I have been automating one CRM application, where I have found correct Xpath, and when I am using this Xpath in the script it shows element not found exception. There is no frame in the application and I have applied the wait statement as well, but still the same exception. Could anyone please help me with this.

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/579fddb8-37b9-4aba-afb7-c2faf271eed1o%40googlegroups.com.
Reply | Threaded
Open this post in threaded view
|

Re: Element not found exception while executing the script

Radhika Joshi
What is the code?

Have you tried using webdriverwait?
(Wait for element to be visible ) or even thread.sleep?

Regards
Radhika Joshi

On Sat, 4 Jul 2020, 10:19 Shweta Choubey, <[hidden email]> wrote:
Hi All,

I have been automating one CRM application, where I have found correct Xpath, and when I am using this Xpath in the script it shows element not found exception. There is no frame in the application and I have applied the wait statement as well, but still the same exception. Could anyone please help me with this.

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/579fddb8-37b9-4aba-afb7-c2faf271eed1o%40googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/CALLrrpL_MSj2xOrD-WN3XgozoB9Kb7uKgRR-tU_SVsJ%3DLQJN5A%40mail.gmail.com.
Reply | Threaded
Open this post in threaded view
|

Re: Element not found exception while executing the script

Shweta Choubey
yes Radhika, here is my code

public void createNewCompany(String company_name) throws InterruptedException
{
WebDriverWait wait1 = new WebDriverWait(driver, 20);
  wait1.until(
  ExpectedConditions.visibilityOfElementLocated((By.xpath(".//button[text()='New']"))));
newCompanyBtn.click();
//****************
  WebDriverWait wait = new WebDriverWait(driver, 50);
  wait.until(
  ExpectedConditions.visibilityOfElementLocated((By.xpath("//div[@class='ui right corner labeled input']//input[@name='name']"))));
  
 
//*************************************
nameOfCompany.sendKeys(company_name);
saveBtn.click();
}

And here is the DOM:

Capture.PNG



On Saturday, July 4, 2020 at 5:58:46 PM UTC+5:30, Radhika Joshi wrote:
What is the code?

Have you tried using webdriverwait?
(Wait for element to be visible ) or even thread.sleep?

Regards
Radhika Joshi

On Sat, 4 Jul 2020, 10:19 Shweta Choubey, <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="cT-ACjloAgAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">shweta....@...> wrote:
Hi All,

I have been automating one CRM application, where I have found correct Xpath, and when I am using this Xpath in the script it shows element not found exception. There is no frame in the application and I have applied the wait statement as well, but still the same exception. Could anyone please help me with this.

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to <a href="javascript:" rel="nofollow" target="_blank" gdf-obfuscated-mailto="cT-ACjloAgAJ" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">seleniu...@googlegroups.com.
To view this discussion on the web visit <a href="https://groups.google.com/d/msgid/selenium-users/579fddb8-37b9-4aba-afb7-c2faf271eed1o%40googlegroups.com?utm_medium=email&amp;utm_source=footer" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://groups.google.com/d/msgid/selenium-users/579fddb8-37b9-4aba-afb7-c2faf271eed1o%40googlegroups.com?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/msgid/selenium-users/579fddb8-37b9-4aba-afb7-c2faf271eed1o%40googlegroups.com?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;">https://groups.google.com/d/msgid/selenium-users/579fddb8-37b9-4aba-afb7-c2faf271eed1o%40googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/105c49c0-482b-43f8-936d-27250cde60f8o%40googlegroups.com.
Reply | Threaded
Open this post in threaded view
|

Re: Element not found exception while executing the script

Radhika Joshi
Hey 
can you send me the exact line where the exception is being found?

Thanks & Regards
Radhika Joshi

On Mon, 6 Jul 2020 at 10:27, Shweta Choubey <[hidden email]> wrote:
yes Radhika, here is my code

public void createNewCompany(String company_name) throws InterruptedException
{
WebDriverWait wait1 = new WebDriverWait(driver, 20);
  wait1.until(
  ExpectedConditions.visibilityOfElementLocated((By.xpath(".//button[text()='New']"))));
newCompanyBtn.click();
//****************
  WebDriverWait wait = new WebDriverWait(driver, 50);
  wait.until(
  ExpectedConditions.visibilityOfElementLocated((By.xpath("//div[@class='ui right corner labeled input']//input[@name='name']"))));
  
 
//*************************************
nameOfCompany.sendKeys(company_name);
saveBtn.click();
}

And here is the DOM:

Capture.PNG



On Saturday, July 4, 2020 at 5:58:46 PM UTC+5:30, Radhika Joshi wrote:
What is the code?

Have you tried using webdriverwait?
(Wait for element to be visible ) or even thread.sleep?

Regards
Radhika Joshi

On Sat, 4 Jul 2020, 10:19 Shweta Choubey, <[hidden email]> wrote:
Hi All,

I have been automating one CRM application, where I have found correct Xpath, and when I am using this Xpath in the script it shows element not found exception. There is no frame in the application and I have applied the wait statement as well, but still the same exception. Could anyone please help me with this.

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/579fddb8-37b9-4aba-afb7-c2faf271eed1o%40googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/105c49c0-482b-43f8-936d-27250cde60f8o%40googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/CALLrrpJEzbCe7V%3D%3Dd5-3F1Jr96zZufkN_aH2AnGE4PWPBD6mEw%40mail.gmail.com.
Reply | Threaded
Open this post in threaded view
|

Re: Element not found exception while executing the script

D Sandeep
In reply to this post by Shweta Choubey
There is not button with text ='New'..

On which line are you having the issue

On Mon, Jul 6, 2020, 00:56 Shweta Choubey <[hidden email]> wrote:
yes Radhika, here is my code

public void createNewCompany(String company_name) throws InterruptedException
{
WebDriverWait wait1 = new WebDriverWait(driver, 20);
  wait1.until(
  ExpectedConditions.visibilityOfElementLocated((By.xpath(".//button[text()='New']"))));
newCompanyBtn.click();
//****************
  WebDriverWait wait = new WebDriverWait(driver, 50);
  wait.until(
  ExpectedConditions.visibilityOfElementLocated((By.xpath("//div[@class='ui right corner labeled input']//input[@name='name']"))));
  
 
//*************************************
nameOfCompany.sendKeys(company_name);
saveBtn.click();
}

And here is the DOM:

Capture.PNG



On Saturday, July 4, 2020 at 5:58:46 PM UTC+5:30, Radhika Joshi wrote:
What is the code?

Have you tried using webdriverwait?
(Wait for element to be visible ) or even thread.sleep?

Regards
Radhika Joshi

On Sat, 4 Jul 2020, 10:19 Shweta Choubey, <[hidden email]> wrote:
Hi All,

I have been automating one CRM application, where I have found correct Xpath, and when I am using this Xpath in the script it shows element not found exception. There is no frame in the application and I have applied the wait statement as well, but still the same exception. Could anyone please help me with this.

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/579fddb8-37b9-4aba-afb7-c2faf271eed1o%40googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/105c49c0-482b-43f8-936d-27250cde60f8o%40googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/CAKh6xULLmzcz4u-ZheWaf_7MAW7vq3CPoQqkBnf%3DRzOQodgpQQ%40mail.gmail.com.
Reply | Threaded
Open this post in threaded view
|

Re: Element not found exception while executing the script

Joel-2
In reply to this post by Shweta Choubey
Welcome to Selenium, land of endless disappointment and frustration. 

Without seeing the application we can't *really* help, but if you're consistently getting this error than you have not found the correct Xpath. You might want to try css selectors to see if you can get any further. Also see if you can locate elements near the one you are interested in, you might discover another approach. 

Is there anything notable about this particular element behavior, i.e. does it only appear in response to another action? 

Good luck. 

On Friday, July 3, 2020 at 9:49:20 PM UTC-7, Shweta Choubey wrote:
Hi All,

I have been automating one CRM application, where I have found correct Xpath, and when I am using this Xpath in the script it shows element not found exception. There is no frame in the application and I have applied the wait statement as well, but still the same exception. Could anyone please help me with this.

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/b0867abb-e26e-4232-9f30-971de01b2403o%40googlegroups.com.
Reply | Threaded
Open this post in threaded view
|

Re: Element not found exception while executing the script

Joel-2
In reply to this post by Shweta Choubey
Just looked at your code snippet. Where is the definition of nameOfCompany element? 

On Sunday, July 5, 2020 at 9:57:06 PM UTC-7, Shweta Choubey wrote:
yes Radhika, here is my code

public void createNewCompany(String company_name) throws InterruptedException
{
WebDriverWait wait1 = new WebDriverWait(driver, 20);
  wait1.until(
  ExpectedConditions.visibilityOfElementLocated((By.xpath(".//button[text()='New']"))));
newCompanyBtn.click();
//****************
  WebDriverWait wait = new WebDriverWait(driver, 50);
  wait.until(
  ExpectedConditions.visibilityOfElementLocated((By.xpath("//div[@class='ui right corner labeled input']//input[@name='name']"))));
  
 
//*************************************
nameOfCompany.sendKeys(company_name);
saveBtn.click();
}

And here is the DOM:

Capture.PNG



On Saturday, July 4, 2020 at 5:58:46 PM UTC+5:30, Radhika Joshi wrote:
What is the code?

Have you tried using webdriverwait?
(Wait for element to be visible ) or even thread.sleep?

Regards
Radhika Joshi

On Sat, 4 Jul 2020, 10:19 Shweta Choubey, <[hidden email]> wrote:
Hi All,

I have been automating one CRM application, where I have found correct Xpath, and when I am using this Xpath in the script it shows element not found exception. There is no frame in the application and I have applied the wait statement as well, but still the same exception. Could anyone please help me with this.

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit <a href="https://groups.google.com/d/msgid/selenium-users/579fddb8-37b9-4aba-afb7-c2faf271eed1o%40googlegroups.com?utm_medium=email&amp;utm_source=footer" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://groups.google.com/d/msgid/selenium-users/579fddb8-37b9-4aba-afb7-c2faf271eed1o%40googlegroups.com?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/msgid/selenium-users/579fddb8-37b9-4aba-afb7-c2faf271eed1o%40googlegroups.com?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;">https://groups.google.com/d/msgid/selenium-users/579fddb8-37b9-4aba-afb7-c2faf271eed1o%40googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/b4aabfee-d45b-401e-bc49-512b467b1c0ao%40googlegroups.com.
Reply | Threaded
Open this post in threaded view
|

Re: Element not found exception while executing the script

Shweta Choubey
In reply to this post by Joel-2
Hi Joel,

Following is the site which I am trying to automate "https://ui.cogmento.com/" when you log in to this site, it had the option of creating a new company. Another point is that when running in debug mode the same script is giving proper results. Don't know what is the problem when the actual script is running.

On Monday, July 6, 2020 at 11:18:38 PM UTC+5:30, Joel wrote:
Welcome to Selenium, land of endless disappointment and frustration. 

Without seeing the application we can't *really* help, but if you're consistently getting this error than you have not found the correct Xpath. You might want to try css selectors to see if you can get any further. Also see if you can locate elements near the one you are interested in, you might discover another approach. 

Is there anything notable about this particular element behavior, i.e. does it only appear in response to another action? 

Good luck. 

On Friday, July 3, 2020 at 9:49:20 PM UTC-7, Shweta Choubey wrote:
Hi All,

I have been automating one CRM application, where I have found correct Xpath, and when I am using this Xpath in the script it shows element not found exception. There is no frame in the application and I have applied the wait statement as well, but still the same exception. Could anyone please help me with this.

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/17bc688f-da5e-4155-be6b-8c2f3ba792f8o%40googlegroups.com.
Reply | Threaded
Open this post in threaded view
|

Re: Element not found exception while executing the script

Joel-2
Had a quick look, I as able to locate in console with $("[placeholder][name]") so you might want to try something along those lines. Also, the element doesn't exist until after you click the New button, so make sure you create nameOfCompany after the new company page is displayed. 

On Monday, July 6, 2020 at 11:22:03 AM UTC-7, Shweta Choubey wrote:
Hi Joel,

Following is the site which I am trying to automate "<a href="https://ui.cogmento.com/" style="font-size:medium" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fui.cogmento.com%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNE4D_Q30cLybs0ClLxJ2cgvpFmT0A&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fui.cogmento.com%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNE4D_Q30cLybs0ClLxJ2cgvpFmT0A&#39;;return true;">https://ui.cogmento.com/" when you log in to this site, it had the option of creating a new company. Another point is that when running in debug mode the same script is giving proper results. Don't know what is the problem when the actual script is running.

On Monday, July 6, 2020 at 11:18:38 PM UTC+5:30, Joel wrote:
Welcome to Selenium, land of endless disappointment and frustration. 

Without seeing the application we can't *really* help, but if you're consistently getting this error than you have not found the correct Xpath. You might want to try css selectors to see if you can get any further. Also see if you can locate elements near the one you are interested in, you might discover another approach. 

Is there anything notable about this particular element behavior, i.e. does it only appear in response to another action? 

Good luck. 

On Friday, July 3, 2020 at 9:49:20 PM UTC-7, Shweta Choubey wrote:
Hi All,

I have been automating one CRM application, where I have found correct Xpath, and when I am using this Xpath in the script it shows element not found exception. There is no frame in the application and I have applied the wait statement as well, but still the same exception. Could anyone please help me with this.

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/680eb601-8c18-43b5-91f5-57288a4a9004o%40googlegroups.com.