Unable to locate the child iframe element which is within the parent iframe through Selenium in Java
So far, this is what I have: I've switched the frame to its parent frame then to the the frame I am unable to locate:
By frame = By.xpath("//iframe[@class='GenCss_style-Model']");
driver.switchTo().frame(driver.findElement(By.name("documentflowdesk")));
driver.switchTo().frame(driver.findElement(frame));
Since 'frame' element is not found, I get this error:
org.openqa.selenium.NoSuchElementException: Unable to locate element
HTML:
<iframe src="about:blank" name="documentflowdesk" class="gwt-Frame-NavigationComponentViewImplResourcesapplicationFrame" id="documentflowdesk" style="position: absolute; left: 0px; top: 0px; visibility: visible; height: 100%;"></iframe>
#documentflowdesk
<html style="overflow: hidden;">
<head>...</head>
<body style="margin: 0px;" class="dragdrop-dropTarget dragdrop-boundary">
<noscript>...</noscript>
<div style="position: absolute; overflow: hidden; left: 0px; top: 0px; right: 0px; bottom: 0px;">
<div class="css-DeskStyleResources" style="position: absolute; left: 0px; top: 0px; right: 0px; bottom: 0px;">
<div style="position: absolute; overflow: hidden; left: 0px; top: 0px; right: 0px; bottom: 0px;">
<div style="position: absolute; left: 0px; top: 0px; right: 0px; bottom: 0px;">
<div style="position: absolute; overflow: hidden; left: 0px; top: 0px; right: 0px; bottom: 0px;">
<iframe class="GenCss_style-Model" src="/model/?modelId=100&docGroupId=164&connectionPointId=73" style="position: absolute; left: 0px; top: 0px; right: 0px; bottom: 0px;"></iframe>
The iframe I'm trying to locate is inside multiple div. Does it have to do anything with the error? Or is there a problem with how I find my element?
java selenium selenium-webdriver iframe webdriverwait
add a comment |
So far, this is what I have: I've switched the frame to its parent frame then to the the frame I am unable to locate:
By frame = By.xpath("//iframe[@class='GenCss_style-Model']");
driver.switchTo().frame(driver.findElement(By.name("documentflowdesk")));
driver.switchTo().frame(driver.findElement(frame));
Since 'frame' element is not found, I get this error:
org.openqa.selenium.NoSuchElementException: Unable to locate element
HTML:
<iframe src="about:blank" name="documentflowdesk" class="gwt-Frame-NavigationComponentViewImplResourcesapplicationFrame" id="documentflowdesk" style="position: absolute; left: 0px; top: 0px; visibility: visible; height: 100%;"></iframe>
#documentflowdesk
<html style="overflow: hidden;">
<head>...</head>
<body style="margin: 0px;" class="dragdrop-dropTarget dragdrop-boundary">
<noscript>...</noscript>
<div style="position: absolute; overflow: hidden; left: 0px; top: 0px; right: 0px; bottom: 0px;">
<div class="css-DeskStyleResources" style="position: absolute; left: 0px; top: 0px; right: 0px; bottom: 0px;">
<div style="position: absolute; overflow: hidden; left: 0px; top: 0px; right: 0px; bottom: 0px;">
<div style="position: absolute; left: 0px; top: 0px; right: 0px; bottom: 0px;">
<div style="position: absolute; overflow: hidden; left: 0px; top: 0px; right: 0px; bottom: 0px;">
<iframe class="GenCss_style-Model" src="/model/?modelId=100&docGroupId=164&connectionPointId=73" style="position: absolute; left: 0px; top: 0px; right: 0px; bottom: 0px;"></iframe>
The iframe I'm trying to locate is inside multiple div. Does it have to do anything with the error? Or is there a problem with how I find my element?
java selenium selenium-webdriver iframe webdriverwait
add a comment |
So far, this is what I have: I've switched the frame to its parent frame then to the the frame I am unable to locate:
By frame = By.xpath("//iframe[@class='GenCss_style-Model']");
driver.switchTo().frame(driver.findElement(By.name("documentflowdesk")));
driver.switchTo().frame(driver.findElement(frame));
Since 'frame' element is not found, I get this error:
org.openqa.selenium.NoSuchElementException: Unable to locate element
HTML:
<iframe src="about:blank" name="documentflowdesk" class="gwt-Frame-NavigationComponentViewImplResourcesapplicationFrame" id="documentflowdesk" style="position: absolute; left: 0px; top: 0px; visibility: visible; height: 100%;"></iframe>
#documentflowdesk
<html style="overflow: hidden;">
<head>...</head>
<body style="margin: 0px;" class="dragdrop-dropTarget dragdrop-boundary">
<noscript>...</noscript>
<div style="position: absolute; overflow: hidden; left: 0px; top: 0px; right: 0px; bottom: 0px;">
<div class="css-DeskStyleResources" style="position: absolute; left: 0px; top: 0px; right: 0px; bottom: 0px;">
<div style="position: absolute; overflow: hidden; left: 0px; top: 0px; right: 0px; bottom: 0px;">
<div style="position: absolute; left: 0px; top: 0px; right: 0px; bottom: 0px;">
<div style="position: absolute; overflow: hidden; left: 0px; top: 0px; right: 0px; bottom: 0px;">
<iframe class="GenCss_style-Model" src="/model/?modelId=100&docGroupId=164&connectionPointId=73" style="position: absolute; left: 0px; top: 0px; right: 0px; bottom: 0px;"></iframe>
The iframe I'm trying to locate is inside multiple div. Does it have to do anything with the error? Or is there a problem with how I find my element?
java selenium selenium-webdriver iframe webdriverwait
So far, this is what I have: I've switched the frame to its parent frame then to the the frame I am unable to locate:
By frame = By.xpath("//iframe[@class='GenCss_style-Model']");
driver.switchTo().frame(driver.findElement(By.name("documentflowdesk")));
driver.switchTo().frame(driver.findElement(frame));
Since 'frame' element is not found, I get this error:
org.openqa.selenium.NoSuchElementException: Unable to locate element
HTML:
<iframe src="about:blank" name="documentflowdesk" class="gwt-Frame-NavigationComponentViewImplResourcesapplicationFrame" id="documentflowdesk" style="position: absolute; left: 0px; top: 0px; visibility: visible; height: 100%;"></iframe>
#documentflowdesk
<html style="overflow: hidden;">
<head>...</head>
<body style="margin: 0px;" class="dragdrop-dropTarget dragdrop-boundary">
<noscript>...</noscript>
<div style="position: absolute; overflow: hidden; left: 0px; top: 0px; right: 0px; bottom: 0px;">
<div class="css-DeskStyleResources" style="position: absolute; left: 0px; top: 0px; right: 0px; bottom: 0px;">
<div style="position: absolute; overflow: hidden; left: 0px; top: 0px; right: 0px; bottom: 0px;">
<div style="position: absolute; left: 0px; top: 0px; right: 0px; bottom: 0px;">
<div style="position: absolute; overflow: hidden; left: 0px; top: 0px; right: 0px; bottom: 0px;">
<iframe class="GenCss_style-Model" src="/model/?modelId=100&docGroupId=164&connectionPointId=73" style="position: absolute; left: 0px; top: 0px; right: 0px; bottom: 0px;"></iframe>
The iframe I'm trying to locate is inside multiple div. Does it have to do anything with the error? Or is there a problem with how I find my element?
java selenium selenium-webdriver iframe webdriverwait
java selenium selenium-webdriver iframe webdriverwait
edited Nov 21 '18 at 11:32
DebanjanB
42.9k94283
42.9k94283
asked Nov 6 '18 at 4:54
CharleneCharlene
82
82
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
As per the HTML once you are on the parent frame you have to:
- Induce WebDriverWait for the parent frame to be available and switch to it.
- Induce WebDriverWait for the child frame to be available and switch to it.
You can use the following solution:
new WebDriverWait(driver, 10).until(ExpectedConditions.frameToBeAvailableAndSwitchToIt(By.xpath("//iframe[@class='gwt-Frame-NavigationComponentViewImplResourcesapplicationFrame' and @id='documentflowdesk']")));
new WebDriverWait(driver, 10).until(ExpectedConditions.frameToBeAvailableAndSwitchToIt(By.xpath("//iframe[@class='GenCss_style-Model' and contains(@src,'connectionPointId')]")));
Here you can find a relevant discussion on Ways to deal with #document under iframe
add a comment |
Please try below code:
driver.switchTo().frame(driver.findelement(By.xpath(//iframe[@name='documentflowdesk']);
Thread.sleep(5000);
driver.switchTo().frame(driver.findelement(By.xpath(//ifame[@class='GenCss_style-Model']);
1
Thread.sleep is bad practice.!
– Code_10
Nov 6 '18 at 6:22
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%2f53165931%2funable-to-locate-the-child-iframe-element-which-is-within-the-parent-iframe-thro%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
As per the HTML once you are on the parent frame you have to:
- Induce WebDriverWait for the parent frame to be available and switch to it.
- Induce WebDriverWait for the child frame to be available and switch to it.
You can use the following solution:
new WebDriverWait(driver, 10).until(ExpectedConditions.frameToBeAvailableAndSwitchToIt(By.xpath("//iframe[@class='gwt-Frame-NavigationComponentViewImplResourcesapplicationFrame' and @id='documentflowdesk']")));
new WebDriverWait(driver, 10).until(ExpectedConditions.frameToBeAvailableAndSwitchToIt(By.xpath("//iframe[@class='GenCss_style-Model' and contains(@src,'connectionPointId')]")));
Here you can find a relevant discussion on Ways to deal with #document under iframe
add a comment |
As per the HTML once you are on the parent frame you have to:
- Induce WebDriverWait for the parent frame to be available and switch to it.
- Induce WebDriverWait for the child frame to be available and switch to it.
You can use the following solution:
new WebDriverWait(driver, 10).until(ExpectedConditions.frameToBeAvailableAndSwitchToIt(By.xpath("//iframe[@class='gwt-Frame-NavigationComponentViewImplResourcesapplicationFrame' and @id='documentflowdesk']")));
new WebDriverWait(driver, 10).until(ExpectedConditions.frameToBeAvailableAndSwitchToIt(By.xpath("//iframe[@class='GenCss_style-Model' and contains(@src,'connectionPointId')]")));
Here you can find a relevant discussion on Ways to deal with #document under iframe
add a comment |
As per the HTML once you are on the parent frame you have to:
- Induce WebDriverWait for the parent frame to be available and switch to it.
- Induce WebDriverWait for the child frame to be available and switch to it.
You can use the following solution:
new WebDriverWait(driver, 10).until(ExpectedConditions.frameToBeAvailableAndSwitchToIt(By.xpath("//iframe[@class='gwt-Frame-NavigationComponentViewImplResourcesapplicationFrame' and @id='documentflowdesk']")));
new WebDriverWait(driver, 10).until(ExpectedConditions.frameToBeAvailableAndSwitchToIt(By.xpath("//iframe[@class='GenCss_style-Model' and contains(@src,'connectionPointId')]")));
Here you can find a relevant discussion on Ways to deal with #document under iframe
As per the HTML once you are on the parent frame you have to:
- Induce WebDriverWait for the parent frame to be available and switch to it.
- Induce WebDriverWait for the child frame to be available and switch to it.
You can use the following solution:
new WebDriverWait(driver, 10).until(ExpectedConditions.frameToBeAvailableAndSwitchToIt(By.xpath("//iframe[@class='gwt-Frame-NavigationComponentViewImplResourcesapplicationFrame' and @id='documentflowdesk']")));
new WebDriverWait(driver, 10).until(ExpectedConditions.frameToBeAvailableAndSwitchToIt(By.xpath("//iframe[@class='GenCss_style-Model' and contains(@src,'connectionPointId')]")));
Here you can find a relevant discussion on Ways to deal with #document under iframe
edited Nov 24 '18 at 7:08
answered Nov 6 '18 at 6:15
DebanjanBDebanjanB
42.9k94283
42.9k94283
add a comment |
add a comment |
Please try below code:
driver.switchTo().frame(driver.findelement(By.xpath(//iframe[@name='documentflowdesk']);
Thread.sleep(5000);
driver.switchTo().frame(driver.findelement(By.xpath(//ifame[@class='GenCss_style-Model']);
1
Thread.sleep is bad practice.!
– Code_10
Nov 6 '18 at 6:22
add a comment |
Please try below code:
driver.switchTo().frame(driver.findelement(By.xpath(//iframe[@name='documentflowdesk']);
Thread.sleep(5000);
driver.switchTo().frame(driver.findelement(By.xpath(//ifame[@class='GenCss_style-Model']);
1
Thread.sleep is bad practice.!
– Code_10
Nov 6 '18 at 6:22
add a comment |
Please try below code:
driver.switchTo().frame(driver.findelement(By.xpath(//iframe[@name='documentflowdesk']);
Thread.sleep(5000);
driver.switchTo().frame(driver.findelement(By.xpath(//ifame[@class='GenCss_style-Model']);
Please try below code:
driver.switchTo().frame(driver.findelement(By.xpath(//iframe[@name='documentflowdesk']);
Thread.sleep(5000);
driver.switchTo().frame(driver.findelement(By.xpath(//ifame[@class='GenCss_style-Model']);
edited Nov 6 '18 at 6:12
DebanjanB
42.9k94283
42.9k94283
answered Nov 6 '18 at 5:54
Kamil KhanKamil Khan
111
111
1
Thread.sleep is bad practice.!
– Code_10
Nov 6 '18 at 6:22
add a comment |
1
Thread.sleep is bad practice.!
– Code_10
Nov 6 '18 at 6:22
1
1
Thread.sleep is bad practice.!
– Code_10
Nov 6 '18 at 6:22
Thread.sleep is bad practice.!
– Code_10
Nov 6 '18 at 6:22
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%2f53165931%2funable-to-locate-the-child-iframe-element-which-is-within-the-parent-iframe-thro%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