Selenium displays NoSuchElementException despite the element being there
So I made a short bit of selenium code, it isn't letting me select elements though! I do not understand. I try copy and pasting examples and none work because of this.
It says: NoSuchElementException: Unable to locate element #login-input
Here is my java code:
WebDriver driver = new FirefoxDriver();
driver.manage().timeouts().implicitlyWait( 10, TimeUnit.SECONDS );
driver.get( "https://www.ticketmaster.com/review" );
WebElement inputElement = driver.findElement( By.id( "login-input" ) );
java selenium selenium-webdriver iframe webdriverwait
add a comment |
So I made a short bit of selenium code, it isn't letting me select elements though! I do not understand. I try copy and pasting examples and none work because of this.
It says: NoSuchElementException: Unable to locate element #login-input
Here is my java code:
WebDriver driver = new FirefoxDriver();
driver.manage().timeouts().implicitlyWait( 10, TimeUnit.SECONDS );
driver.get( "https://www.ticketmaster.com/review" );
WebElement inputElement = driver.findElement( By.id( "login-input" ) );
java selenium selenium-webdriver iframe webdriverwait
Possible duplicate of Find elements inside forms and iframe using Java and Selenium WebDriver
– JeffC
Nov 24 '18 at 2:48
add a comment |
So I made a short bit of selenium code, it isn't letting me select elements though! I do not understand. I try copy and pasting examples and none work because of this.
It says: NoSuchElementException: Unable to locate element #login-input
Here is my java code:
WebDriver driver = new FirefoxDriver();
driver.manage().timeouts().implicitlyWait( 10, TimeUnit.SECONDS );
driver.get( "https://www.ticketmaster.com/review" );
WebElement inputElement = driver.findElement( By.id( "login-input" ) );
java selenium selenium-webdriver iframe webdriverwait
So I made a short bit of selenium code, it isn't letting me select elements though! I do not understand. I try copy and pasting examples and none work because of this.
It says: NoSuchElementException: Unable to locate element #login-input
Here is my java code:
WebDriver driver = new FirefoxDriver();
driver.manage().timeouts().implicitlyWait( 10, TimeUnit.SECONDS );
driver.get( "https://www.ticketmaster.com/review" );
WebElement inputElement = driver.findElement( By.id( "login-input" ) );
java selenium selenium-webdriver iframe webdriverwait
java selenium selenium-webdriver iframe webdriverwait
edited Nov 24 '18 at 7:21
DebanjanB
40.6k73878
40.6k73878
asked Nov 24 '18 at 2:28
FX_NINJAFX_NINJA
985
985
Possible duplicate of Find elements inside forms and iframe using Java and Selenium WebDriver
– JeffC
Nov 24 '18 at 2:48
add a comment |
Possible duplicate of Find elements inside forms and iframe using Java and Selenium WebDriver
– JeffC
Nov 24 '18 at 2:48
Possible duplicate of Find elements inside forms and iframe using Java and Selenium WebDriver
– JeffC
Nov 24 '18 at 2:48
Possible duplicate of Find elements inside forms and iframe using Java and Selenium WebDriver
– JeffC
Nov 24 '18 at 2:48
add a comment |
2 Answers
2
active
oldest
votes
Your login form is inside the iframe
. Switch your driver first, try the bellow code :
WebDriver driver = new FirefoxDriver();
driver.manage().timeouts().implicitlyWait( 10, TimeUnit.SECONDS );
driver.get( "https://www.ticketmaster.com/review" );
driver.switchTo().frame("loginFrame");
WebElement inputElement = driver.findElement( By.id( "login-input" ) );
inputElement.sendKeys("test");
add a comment |
The username and password fields are within an iframe
, so you have to:
- Induce WebDriverWait for the desired frame to be available and switch to it.
- Induce WebDriverWait for the desired element to be clickable.
You can use the following solution:
WebDriver driver = new FirefoxDriver();
driver.get( "https://www.ticketmaster.com/review" );
new WebDriverWait(driver, 10).until(ExpectedConditions.frameToBeAvailableAndSwitchToIt(By.cssSelector("iframe#loginFrame")));
new WebDriverWait(driver, 20).until(ExpectedConditions.elementToBeClickable(By.cssSelector("label[for='login-input']"))).sendKeys("FX_NINJA");
add a comment |
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',
autoActivateHeartbeat: false,
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
});
}
});
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%2f53454683%2fselenium-displays-nosuchelementexception-despite-the-element-being-there%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
Your login form is inside the iframe
. Switch your driver first, try the bellow code :
WebDriver driver = new FirefoxDriver();
driver.manage().timeouts().implicitlyWait( 10, TimeUnit.SECONDS );
driver.get( "https://www.ticketmaster.com/review" );
driver.switchTo().frame("loginFrame");
WebElement inputElement = driver.findElement( By.id( "login-input" ) );
inputElement.sendKeys("test");
add a comment |
Your login form is inside the iframe
. Switch your driver first, try the bellow code :
WebDriver driver = new FirefoxDriver();
driver.manage().timeouts().implicitlyWait( 10, TimeUnit.SECONDS );
driver.get( "https://www.ticketmaster.com/review" );
driver.switchTo().frame("loginFrame");
WebElement inputElement = driver.findElement( By.id( "login-input" ) );
inputElement.sendKeys("test");
add a comment |
Your login form is inside the iframe
. Switch your driver first, try the bellow code :
WebDriver driver = new FirefoxDriver();
driver.manage().timeouts().implicitlyWait( 10, TimeUnit.SECONDS );
driver.get( "https://www.ticketmaster.com/review" );
driver.switchTo().frame("loginFrame");
WebElement inputElement = driver.findElement( By.id( "login-input" ) );
inputElement.sendKeys("test");
Your login form is inside the iframe
. Switch your driver first, try the bellow code :
WebDriver driver = new FirefoxDriver();
driver.manage().timeouts().implicitlyWait( 10, TimeUnit.SECONDS );
driver.get( "https://www.ticketmaster.com/review" );
driver.switchTo().frame("loginFrame");
WebElement inputElement = driver.findElement( By.id( "login-input" ) );
inputElement.sendKeys("test");
answered Nov 24 '18 at 6:56
FrianFrian
858
858
add a comment |
add a comment |
The username and password fields are within an iframe
, so you have to:
- Induce WebDriverWait for the desired frame to be available and switch to it.
- Induce WebDriverWait for the desired element to be clickable.
You can use the following solution:
WebDriver driver = new FirefoxDriver();
driver.get( "https://www.ticketmaster.com/review" );
new WebDriverWait(driver, 10).until(ExpectedConditions.frameToBeAvailableAndSwitchToIt(By.cssSelector("iframe#loginFrame")));
new WebDriverWait(driver, 20).until(ExpectedConditions.elementToBeClickable(By.cssSelector("label[for='login-input']"))).sendKeys("FX_NINJA");
add a comment |
The username and password fields are within an iframe
, so you have to:
- Induce WebDriverWait for the desired frame to be available and switch to it.
- Induce WebDriverWait for the desired element to be clickable.
You can use the following solution:
WebDriver driver = new FirefoxDriver();
driver.get( "https://www.ticketmaster.com/review" );
new WebDriverWait(driver, 10).until(ExpectedConditions.frameToBeAvailableAndSwitchToIt(By.cssSelector("iframe#loginFrame")));
new WebDriverWait(driver, 20).until(ExpectedConditions.elementToBeClickable(By.cssSelector("label[for='login-input']"))).sendKeys("FX_NINJA");
add a comment |
The username and password fields are within an iframe
, so you have to:
- Induce WebDriverWait for the desired frame to be available and switch to it.
- Induce WebDriverWait for the desired element to be clickable.
You can use the following solution:
WebDriver driver = new FirefoxDriver();
driver.get( "https://www.ticketmaster.com/review" );
new WebDriverWait(driver, 10).until(ExpectedConditions.frameToBeAvailableAndSwitchToIt(By.cssSelector("iframe#loginFrame")));
new WebDriverWait(driver, 20).until(ExpectedConditions.elementToBeClickable(By.cssSelector("label[for='login-input']"))).sendKeys("FX_NINJA");
The username and password fields are within an iframe
, so you have to:
- Induce WebDriverWait for the desired frame to be available and switch to it.
- Induce WebDriverWait for the desired element to be clickable.
You can use the following solution:
WebDriver driver = new FirefoxDriver();
driver.get( "https://www.ticketmaster.com/review" );
new WebDriverWait(driver, 10).until(ExpectedConditions.frameToBeAvailableAndSwitchToIt(By.cssSelector("iframe#loginFrame")));
new WebDriverWait(driver, 20).until(ExpectedConditions.elementToBeClickable(By.cssSelector("label[for='login-input']"))).sendKeys("FX_NINJA");
answered Nov 24 '18 at 7:22
DebanjanBDebanjanB
40.6k73878
40.6k73878
add a comment |
add a comment |
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.
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%2f53454683%2fselenium-displays-nosuchelementexception-despite-the-element-being-there%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
Possible duplicate of Find elements inside forms and iframe using Java and Selenium WebDriver
– JeffC
Nov 24 '18 at 2:48