Selecting address value from pop up in Selenium Webdriver
up vote
0
down vote
favorite
Developer Tools view of the popup
I have to select 2nd value in the list of addresses on amazon.com, using Selenium web driver
Here is my Code-
package TechniquesToAutomate;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.support.ui.Select;
public class Dropdown {
public static void main(String args) {
System.setProperty("webdriver.chrome.driver", "C:\chromedriver.exe");
WebDriver driver = new ChromeDriver();
driver.get("https://amazon.com");
driver.findElement(By.id("nav-link-accountList")).click();
WebElement element = driver.findElement(By.id("ap_email"));
element.sendKeys("dummy@gmail.com");
element = driver.findElement(By.id("ap_password"));
element.sendKeys("abcd123");
driver.findElement(By.id("signInSubmit")).click();;
driver.findElement(By.id("nav-global-location-slot")).click();
driver.switchTo().activeElement();
driver.findElement(By.cssSelector ("//input[@name=2OPOJECBKZWO3TPDJUPIG12Q1WNJDTIR2A2R2RITDJNW1Q6PXTQ2FQA2OXNA3KWU:1:milprpoqnin")
).click();
driver.findElement(By.name("glowDoneButton")).click();
}
}
But I'm getting an exception-
Exception in thread "main" org.openqa.selenium.NoSuchElementException:
no such element: Unable to locate element:
{"method":"xpath","selector":"//*[@id="a-autoid-2-announce"]/input"}
Any input if there is something else that I can try?
selenium selenium-webdriver popup selenium-chromedriver
|
show 1 more comment
up vote
0
down vote
favorite
Developer Tools view of the popup
I have to select 2nd value in the list of addresses on amazon.com, using Selenium web driver
Here is my Code-
package TechniquesToAutomate;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.support.ui.Select;
public class Dropdown {
public static void main(String args) {
System.setProperty("webdriver.chrome.driver", "C:\chromedriver.exe");
WebDriver driver = new ChromeDriver();
driver.get("https://amazon.com");
driver.findElement(By.id("nav-link-accountList")).click();
WebElement element = driver.findElement(By.id("ap_email"));
element.sendKeys("dummy@gmail.com");
element = driver.findElement(By.id("ap_password"));
element.sendKeys("abcd123");
driver.findElement(By.id("signInSubmit")).click();;
driver.findElement(By.id("nav-global-location-slot")).click();
driver.switchTo().activeElement();
driver.findElement(By.cssSelector ("//input[@name=2OPOJECBKZWO3TPDJUPIG12Q1WNJDTIR2A2R2RITDJNW1Q6PXTQ2FQA2OXNA3KWU:1:milprpoqnin")
).click();
driver.findElement(By.name("glowDoneButton")).click();
}
}
But I'm getting an exception-
Exception in thread "main" org.openqa.selenium.NoSuchElementException:
no such element: Unable to locate element:
{"method":"xpath","selector":"//*[@id="a-autoid-2-announce"]/input"}
Any input if there is something else that I can try?
selenium selenium-webdriver popup selenium-chromedriver
1
Don't post html and code as images. Post them as text.
– Guy
Nov 11 at 12:57
Thank you!. I have given the code, however for the developer tools, I had to go with the image for a better explanation
– Ravi
Nov 11 at 18:00
Looks like the input element which you are searching for, does not have a fixed name. Try searching using class name 'a-button-input'.
– Kamal
Nov 12 at 7:35
@Ravi More than the image of the element and html, the text based HTML would have been more helpful to analyze the issue.
– DebanjanB
Nov 12 at 10:13
@DebanjanB - Basically after logging into amazon.com, I want to be able to select the second entry in the address pop-up that comes on clicking "Deliver to" button on top left corner. That functionality is common and the inspect code can be accessed by anyone. I'm not able to do so using the code that I have given above.
– Ravi
Nov 12 at 16:10
|
show 1 more comment
up vote
0
down vote
favorite
up vote
0
down vote
favorite
Developer Tools view of the popup
I have to select 2nd value in the list of addresses on amazon.com, using Selenium web driver
Here is my Code-
package TechniquesToAutomate;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.support.ui.Select;
public class Dropdown {
public static void main(String args) {
System.setProperty("webdriver.chrome.driver", "C:\chromedriver.exe");
WebDriver driver = new ChromeDriver();
driver.get("https://amazon.com");
driver.findElement(By.id("nav-link-accountList")).click();
WebElement element = driver.findElement(By.id("ap_email"));
element.sendKeys("dummy@gmail.com");
element = driver.findElement(By.id("ap_password"));
element.sendKeys("abcd123");
driver.findElement(By.id("signInSubmit")).click();;
driver.findElement(By.id("nav-global-location-slot")).click();
driver.switchTo().activeElement();
driver.findElement(By.cssSelector ("//input[@name=2OPOJECBKZWO3TPDJUPIG12Q1WNJDTIR2A2R2RITDJNW1Q6PXTQ2FQA2OXNA3KWU:1:milprpoqnin")
).click();
driver.findElement(By.name("glowDoneButton")).click();
}
}
But I'm getting an exception-
Exception in thread "main" org.openqa.selenium.NoSuchElementException:
no such element: Unable to locate element:
{"method":"xpath","selector":"//*[@id="a-autoid-2-announce"]/input"}
Any input if there is something else that I can try?
selenium selenium-webdriver popup selenium-chromedriver
Developer Tools view of the popup
I have to select 2nd value in the list of addresses on amazon.com, using Selenium web driver
Here is my Code-
package TechniquesToAutomate;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.support.ui.Select;
public class Dropdown {
public static void main(String args) {
System.setProperty("webdriver.chrome.driver", "C:\chromedriver.exe");
WebDriver driver = new ChromeDriver();
driver.get("https://amazon.com");
driver.findElement(By.id("nav-link-accountList")).click();
WebElement element = driver.findElement(By.id("ap_email"));
element.sendKeys("dummy@gmail.com");
element = driver.findElement(By.id("ap_password"));
element.sendKeys("abcd123");
driver.findElement(By.id("signInSubmit")).click();;
driver.findElement(By.id("nav-global-location-slot")).click();
driver.switchTo().activeElement();
driver.findElement(By.cssSelector ("//input[@name=2OPOJECBKZWO3TPDJUPIG12Q1WNJDTIR2A2R2RITDJNW1Q6PXTQ2FQA2OXNA3KWU:1:milprpoqnin")
).click();
driver.findElement(By.name("glowDoneButton")).click();
}
}
But I'm getting an exception-
Exception in thread "main" org.openqa.selenium.NoSuchElementException:
no such element: Unable to locate element:
{"method":"xpath","selector":"//*[@id="a-autoid-2-announce"]/input"}
Any input if there is something else that I can try?
selenium selenium-webdriver popup selenium-chromedriver
selenium selenium-webdriver popup selenium-chromedriver
edited Nov 12 at 1:11
Navarasu
1,8321721
1,8321721
asked Nov 11 at 10:58
Ravi
84
84
1
Don't post html and code as images. Post them as text.
– Guy
Nov 11 at 12:57
Thank you!. I have given the code, however for the developer tools, I had to go with the image for a better explanation
– Ravi
Nov 11 at 18:00
Looks like the input element which you are searching for, does not have a fixed name. Try searching using class name 'a-button-input'.
– Kamal
Nov 12 at 7:35
@Ravi More than the image of the element and html, the text based HTML would have been more helpful to analyze the issue.
– DebanjanB
Nov 12 at 10:13
@DebanjanB - Basically after logging into amazon.com, I want to be able to select the second entry in the address pop-up that comes on clicking "Deliver to" button on top left corner. That functionality is common and the inspect code can be accessed by anyone. I'm not able to do so using the code that I have given above.
– Ravi
Nov 12 at 16:10
|
show 1 more comment
1
Don't post html and code as images. Post them as text.
– Guy
Nov 11 at 12:57
Thank you!. I have given the code, however for the developer tools, I had to go with the image for a better explanation
– Ravi
Nov 11 at 18:00
Looks like the input element which you are searching for, does not have a fixed name. Try searching using class name 'a-button-input'.
– Kamal
Nov 12 at 7:35
@Ravi More than the image of the element and html, the text based HTML would have been more helpful to analyze the issue.
– DebanjanB
Nov 12 at 10:13
@DebanjanB - Basically after logging into amazon.com, I want to be able to select the second entry in the address pop-up that comes on clicking "Deliver to" button on top left corner. That functionality is common and the inspect code can be accessed by anyone. I'm not able to do so using the code that I have given above.
– Ravi
Nov 12 at 16:10
1
1
Don't post html and code as images. Post them as text.
– Guy
Nov 11 at 12:57
Don't post html and code as images. Post them as text.
– Guy
Nov 11 at 12:57
Thank you!. I have given the code, however for the developer tools, I had to go with the image for a better explanation
– Ravi
Nov 11 at 18:00
Thank you!. I have given the code, however for the developer tools, I had to go with the image for a better explanation
– Ravi
Nov 11 at 18:00
Looks like the input element which you are searching for, does not have a fixed name. Try searching using class name 'a-button-input'.
– Kamal
Nov 12 at 7:35
Looks like the input element which you are searching for, does not have a fixed name. Try searching using class name 'a-button-input'.
– Kamal
Nov 12 at 7:35
@Ravi More than the image of the element and html, the text based HTML would have been more helpful to analyze the issue.
– DebanjanB
Nov 12 at 10:13
@Ravi More than the image of the element and html, the text based HTML would have been more helpful to analyze the issue.
– DebanjanB
Nov 12 at 10:13
@DebanjanB - Basically after logging into amazon.com, I want to be able to select the second entry in the address pop-up that comes on clicking "Deliver to" button on top left corner. That functionality is common and the inspect code can be accessed by anyone. I'm not able to do so using the code that I have given above.
– Ravi
Nov 12 at 16:10
@DebanjanB - Basically after logging into amazon.com, I want to be able to select the second entry in the address pop-up that comes on clicking "Deliver to" button on top left corner. That functionality is common and the inspect code can be accessed by anyone. I'm not able to do so using the code that I have given above.
– Ravi
Nov 12 at 16:10
|
show 1 more comment
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53248041%2fselecting-address-value-from-pop-up-in-selenium-webdriver%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
Don't post html and code as images. Post them as text.
– Guy
Nov 11 at 12:57
Thank you!. I have given the code, however for the developer tools, I had to go with the image for a better explanation
– Ravi
Nov 11 at 18:00
Looks like the input element which you are searching for, does not have a fixed name. Try searching using class name 'a-button-input'.
– Kamal
Nov 12 at 7:35
@Ravi More than the image of the element and html, the text based HTML would have been more helpful to analyze the issue.
– DebanjanB
Nov 12 at 10:13
@DebanjanB - Basically after logging into amazon.com, I want to be able to select the second entry in the address pop-up that comes on clicking "Deliver to" button on top left corner. That functionality is common and the inspect code can be accessed by anyone. I'm not able to do so using the code that I have given above.
– Ravi
Nov 12 at 16:10