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!
javascript selenium selenium-webdriver protractor
add a comment |
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!
javascript selenium selenium-webdriver protractor
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
add a comment |
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!
javascript selenium selenium-webdriver protractor
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
javascript selenium selenium-webdriver protractor
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
add a comment |
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
add a comment |
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
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
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
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
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
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
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