Selecting address value from pop up in Selenium Webdriver











up vote
0
down vote

favorite












Developer Tools view of the popup



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?










share|improve this question




















  • 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

















up vote
0
down vote

favorite












Developer Tools view of the popup



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?










share|improve this question




















  • 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















up vote
0
down vote

favorite









up vote
0
down vote

favorite











Developer Tools view of the popup



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?










share|improve this question















Developer Tools view of the popup



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






share|improve this question















share|improve this question













share|improve this question




share|improve this question








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
















  • 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



















active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















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






























active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes
















draft saved

draft discarded




















































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.




draft saved


draft discarded














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





















































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







Popular posts from this blog

Xamarin.iOS Cant Deploy on Iphone

Glorious Revolution

Dulmage-Mendelsohn matrix decomposition in Python