Ways to deal with #document under iframe











up vote
1
down vote

favorite












For the portal I am testing now, I came with the problem that I could not create any xpath locators, after some time I figured out that it was because of an '#document', this cuts the path and makes the simple "copy xpath" to direct the path to a completely different element.



<iframe id="FRAMENAME" src="/webclient/workspace/launch-task/REMbl?ds=BP" width="100%" height="100%" frameborder="0" data-navitemname="navitemname" style="" xpath="1">
#document
<html>
CODE....
</html>




I found the solution for this is it is simply add a switchTo like this:



driver.switchTo().frame("FRAMENAME");


This works and makes the rest of the code to work properly but, takes some extra time processing this command till the code moves to the next line.



So I would like to ask, is there is a better solution for this? something smarter/faster?



I am concerned that when the point where I have lots of scripts comes, the execution time will take too long.



I don't use id locators for example because they are all dynamic so sometimes a xpath is required.



Thank you!










share|improve this question






















  • This is the only way to access elements inside <iframe>. You could post your code at code review, maybe someone will see things you can improve.
    – Guy
    yesterday










  • Hi, thanks for the answer, the portal is not developed by us which makes difficult to change the code, we are developing a tool to work with this and the purpose of this test is to check that the info was imported correctly. the rest of the test code goes fast, the only point is that slowdown, but anyway I will post there just in case. thanks!
    – Alexandre
    yesterday










  • I suggested you post your code there, not the website :). How much time does the switch take, I never incarcerated any problem with it.
    – Guy
    yesterday










  • ah ok hehehe, well it depends the screen it is but I would say from 4 to 6 seconds per switch, so in a test case where I need to interact with different frames this would increase the execution time, for now it is no big issue but in the future might take too long. thanks for the help!
    – Alexandre
    yesterday















up vote
1
down vote

favorite












For the portal I am testing now, I came with the problem that I could not create any xpath locators, after some time I figured out that it was because of an '#document', this cuts the path and makes the simple "copy xpath" to direct the path to a completely different element.



<iframe id="FRAMENAME" src="/webclient/workspace/launch-task/REMbl?ds=BP" width="100%" height="100%" frameborder="0" data-navitemname="navitemname" style="" xpath="1">
#document
<html>
CODE....
</html>




I found the solution for this is it is simply add a switchTo like this:



driver.switchTo().frame("FRAMENAME");


This works and makes the rest of the code to work properly but, takes some extra time processing this command till the code moves to the next line.



So I would like to ask, is there is a better solution for this? something smarter/faster?



I am concerned that when the point where I have lots of scripts comes, the execution time will take too long.



I don't use id locators for example because they are all dynamic so sometimes a xpath is required.



Thank you!










share|improve this question






















  • This is the only way to access elements inside <iframe>. You could post your code at code review, maybe someone will see things you can improve.
    – Guy
    yesterday










  • Hi, thanks for the answer, the portal is not developed by us which makes difficult to change the code, we are developing a tool to work with this and the purpose of this test is to check that the info was imported correctly. the rest of the test code goes fast, the only point is that slowdown, but anyway I will post there just in case. thanks!
    – Alexandre
    yesterday










  • I suggested you post your code there, not the website :). How much time does the switch take, I never incarcerated any problem with it.
    – Guy
    yesterday










  • ah ok hehehe, well it depends the screen it is but I would say from 4 to 6 seconds per switch, so in a test case where I need to interact with different frames this would increase the execution time, for now it is no big issue but in the future might take too long. thanks for the help!
    – Alexandre
    yesterday













up vote
1
down vote

favorite









up vote
1
down vote

favorite











For the portal I am testing now, I came with the problem that I could not create any xpath locators, after some time I figured out that it was because of an '#document', this cuts the path and makes the simple "copy xpath" to direct the path to a completely different element.



<iframe id="FRAMENAME" src="/webclient/workspace/launch-task/REMbl?ds=BP" width="100%" height="100%" frameborder="0" data-navitemname="navitemname" style="" xpath="1">
#document
<html>
CODE....
</html>




I found the solution for this is it is simply add a switchTo like this:



driver.switchTo().frame("FRAMENAME");


This works and makes the rest of the code to work properly but, takes some extra time processing this command till the code moves to the next line.



So I would like to ask, is there is a better solution for this? something smarter/faster?



I am concerned that when the point where I have lots of scripts comes, the execution time will take too long.



I don't use id locators for example because they are all dynamic so sometimes a xpath is required.



Thank you!










share|improve this question













For the portal I am testing now, I came with the problem that I could not create any xpath locators, after some time I figured out that it was because of an '#document', this cuts the path and makes the simple "copy xpath" to direct the path to a completely different element.



<iframe id="FRAMENAME" src="/webclient/workspace/launch-task/REMbl?ds=BP" width="100%" height="100%" frameborder="0" data-navitemname="navitemname" style="" xpath="1">
#document
<html>
CODE....
</html>




I found the solution for this is it is simply add a switchTo like this:



driver.switchTo().frame("FRAMENAME");


This works and makes the rest of the code to work properly but, takes some extra time processing this command till the code moves to the next line.



So I would like to ask, is there is a better solution for this? something smarter/faster?



I am concerned that when the point where I have lots of scripts comes, the execution time will take too long.



I don't use id locators for example because they are all dynamic so sometimes a xpath is required.



Thank you!







javascript selenium selenium-webdriver protractor






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked yesterday









Alexandre

636




636












  • This is the only way to access elements inside <iframe>. You could post your code at code review, maybe someone will see things you can improve.
    – Guy
    yesterday










  • Hi, thanks for the answer, the portal is not developed by us which makes difficult to change the code, we are developing a tool to work with this and the purpose of this test is to check that the info was imported correctly. the rest of the test code goes fast, the only point is that slowdown, but anyway I will post there just in case. thanks!
    – Alexandre
    yesterday










  • I suggested you post your code there, not the website :). How much time does the switch take, I never incarcerated any problem with it.
    – Guy
    yesterday










  • ah ok hehehe, well it depends the screen it is but I would say from 4 to 6 seconds per switch, so in a test case where I need to interact with different frames this would increase the execution time, for now it is no big issue but in the future might take too long. thanks for the help!
    – Alexandre
    yesterday


















  • This is the only way to access elements inside <iframe>. You could post your code at code review, maybe someone will see things you can improve.
    – Guy
    yesterday










  • Hi, thanks for the answer, the portal is not developed by us which makes difficult to change the code, we are developing a tool to work with this and the purpose of this test is to check that the info was imported correctly. the rest of the test code goes fast, the only point is that slowdown, but anyway I will post there just in case. thanks!
    – Alexandre
    yesterday










  • I suggested you post your code there, not the website :). How much time does the switch take, I never incarcerated any problem with it.
    – Guy
    yesterday










  • ah ok hehehe, well it depends the screen it is but I would say from 4 to 6 seconds per switch, so in a test case where I need to interact with different frames this would increase the execution time, for now it is no big issue but in the future might take too long. thanks for the help!
    – Alexandre
    yesterday
















This is the only way to access elements inside <iframe>. You could post your code at code review, maybe someone will see things you can improve.
– Guy
yesterday




This is the only way to access elements inside <iframe>. You could post your code at code review, maybe someone will see things you can improve.
– Guy
yesterday












Hi, thanks for the answer, the portal is not developed by us which makes difficult to change the code, we are developing a tool to work with this and the purpose of this test is to check that the info was imported correctly. the rest of the test code goes fast, the only point is that slowdown, but anyway I will post there just in case. thanks!
– Alexandre
yesterday




Hi, thanks for the answer, the portal is not developed by us which makes difficult to change the code, we are developing a tool to work with this and the purpose of this test is to check that the info was imported correctly. the rest of the test code goes fast, the only point is that slowdown, but anyway I will post there just in case. thanks!
– Alexandre
yesterday












I suggested you post your code there, not the website :). How much time does the switch take, I never incarcerated any problem with it.
– Guy
yesterday




I suggested you post your code there, not the website :). How much time does the switch take, I never incarcerated any problem with it.
– Guy
yesterday












ah ok hehehe, well it depends the screen it is but I would say from 4 to 6 seconds per switch, so in a test case where I need to interact with different frames this would increase the execution time, for now it is no big issue but in the future might take too long. thanks for the help!
– Alexandre
yesterday




ah ok hehehe, well it depends the screen it is but I would say from 4 to 6 seconds per switch, so in a test case where I need to interact with different frames this would increase the execution time, for now it is no big issue but in the future might take too long. thanks for the help!
– Alexandre
yesterday

















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%2f53203417%2fways-to-deal-with-document-under-iframe%23new-answer', 'question_page');
}
);

Post as a guest





































active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes
















 

draft saved


draft discarded



















































 


draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53203417%2fways-to-deal-with-document-under-iframe%23new-answer', 'question_page');
}
);

Post as a guest




















































































Popular posts from this blog

Landwehr

Reims

Schenkenzell