Selenium2 cannot located elements in iframe in cross-domain environment

1,289 views
Skip to first unread message

simply_tester

unread,
Jul 20, 2012, 8:59:21 PM7/20/12
to seleniu...@googlegroups.com
Hi,

I'm running into an issue where I get redirected to another domain page where all the elementes are inside the iframe and my selenium2 script only finds first element out of x amount of elements specified. After that script fails since next element cannot be located. Ii've tried to locate other elements using all sorts of locators supported in Selenium2, as well as, using JavascriptExecutor - but same failure. One web-dev told me it could be possible due to iframes and cross-domain environment.
 
Please recommend a solution. 

Thanks

Peter Gale

unread,
Jul 21, 2012, 3:52:53 AM7/21/12
to Selenium Users
Do you get the same problem when testing the page manually?


Date: Fri, 20 Jul 2012 17:59:21 -0700
From: dan...@gmail.com
To: seleniu...@googlegroups.com
Subject: [selenium-users] Selenium2 cannot located elements in iframe in cross-domain environment
--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To post to this group, send email to seleniu...@googlegroups.com.
To unsubscribe from this group, send email to selenium-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msg/selenium-users/-/_aBd7HSRr3sJ.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

santoshsarma jayanthi

unread,
Jul 22, 2012, 2:15:18 AM7/22/12
to seleniu...@googlegroups.com
Yes that is true. I also faced the same problem.

Ask your developers to make the iframe also in same domain. I think it is small change in JS for developers.
--
Regards,
-SantoshSarma
LinkedIn | Twitter | Facebook

kaushik mahata

unread,
Jul 22, 2012, 12:43:50 PM7/22/12
to seleniu...@googlegroups.com
Have you tried to first switch to the iframe and than look for elements inside it?

simply_tester

unread,
Jul 23, 2012, 2:15:09 PM7/23/12
to seleniu...@googlegroups.com
Hi,

Thanks for replying. Manually, everything works - I can see all necessary elements and click on them.

Thanks,


On Saturday, July 21, 2012 12:52:53 AM UTC-7, PeterJef...@Hotmail.co.uk wrote:
Do you get the same problem when testing the page manually?


Date: Fri, 20 Jul 2012 17:59:21 -0700
From: dan...@gmail.com

Subject: [selenium-users] Selenium2 cannot located elements in iframe in cross-domain environment

Hi,

I'm running into an issue where I get redirected to another domain page where all the elementes are inside the iframe and my selenium2 script only finds first element out of x amount of elements specified. After that script fails since next element cannot be located. Ii've tried to locate other elements using all sorts of locators supported in Selenium2, as well as, using JavascriptExecutor - but same failure. One web-dev told me it could be possible due to iframes and cross-domain environment.
 
Please recommend a solution. 

Thanks

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To post to this group, send email to selenium-users@googlegroups.com.
To unsubscribe from this group, send email to selenium-users+unsubscribe@googlegroups.com.

simply_tester

unread,
Jul 23, 2012, 2:16:35 PM7/23/12
to seleniu...@googlegroups.com
Hi,

Thanks for replying. The problem is that devs won't make such change in order for me to test, I need to find a solution to test the way it is :)

Thanks,



On Saturday, July 21, 2012 11:15:18 PM UTC-7, SantoshSarma wrote:
Yes that is true. I also faced the same problem.

Ask your developers to make the iframe also in same domain. I think it is small change in JS for developers.
On Sat, Jul 21, 2012 at 1:22 PM, Peter Gale <peterjef...@hotmail.co.uk> wrote:
Do you get the same problem when testing the page manually?


Date: Fri, 20 Jul 2012 17:59:21 -0700
From: dan...@gmail.com

Subject: [selenium-users] Selenium2 cannot located elements in iframe in cross-domain environment


Hi,

I'm running into an issue where I get redirected to another domain page where all the elementes are inside the iframe and my selenium2 script only finds first element out of x amount of elements specified. After that script fails since next element cannot be located. Ii've tried to locate other elements using all sorts of locators supported in Selenium2, as well as, using JavascriptExecutor - but same failure. One web-dev told me it could be possible due to iframes and cross-domain environment.
 
Please recommend a solution. 

Thanks

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To post to this group, send email to selenium-users@googlegroups.com.
To unsubscribe from this group, send email to selenium-users+unsubscribe@googlegroups.com.

To view this discussion on the web visit https://groups.google.com/d/msg/selenium-users/-/_aBd7HSRr3sJ.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To post to this group, send email to selenium-users@googlegroups.com.
To unsubscribe from this group, send email to selenium-users+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/groups/opt_out.
 
 

simply_tester

unread,
Jul 23, 2012, 2:22:10 PM7/23/12
to seleniu...@googlegroups.com
Hi,

Thanks for replying and suggestion. That is exactly what I'm doing in my script. As soon as page with an iframe loads (I explicitly give it 60 sec to make sure all the elements are there), I switch to iframe and try to locate necessary elements. This is where security problem begins, since it only finds the very first element I specify in the code (I've noticed this by changing around elements to be searched for), then it fails to locate whatever next element I'm searching for.

Thanks,



 

On Sunday, July 22, 2012 9:43:50 AM UTC-7, kaushik wrote:
Have you tried to first switch to the iframe and than look for elements inside it?

On Sun, Jul 22, 2012 at 11:45 AM, santoshsarma jayanthi <santosh...@gmail.com> wrote:
Yes that is true. I also faced the same problem.

Ask your developers to make the iframe also in same domain. I think it is small change in JS for developers.
On Sat, Jul 21, 2012 at 1:22 PM, Peter Gale <peterjef...@hotmail.co.uk> wrote:
Do you get the same problem when testing the page manually?


Date: Fri, 20 Jul 2012 17:59:21 -0700
From: dan...@gmail.com

Subject: [selenium-users] Selenium2 cannot located elements in iframe in cross-domain environment


Hi,

I'm running into an issue where I get redirected to another domain page where all the elementes are inside the iframe and my selenium2 script only finds first element out of x amount of elements specified. After that script fails since next element cannot be located. Ii've tried to locate other elements using all sorts of locators supported in Selenium2, as well as, using JavascriptExecutor - but same failure. One web-dev told me it could be possible due to iframes and cross-domain environment.
 
Please recommend a solution. 

Thanks

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To post to this group, send email to selenium-users@googlegroups.com.
To unsubscribe from this group, send email to selenium-users+unsubscribe@googlegroups.com.

To view this discussion on the web visit https://groups.google.com/d/msg/selenium-users/-/_aBd7HSRr3sJ.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To post to this group, send email to selenium-users@googlegroups.com.
To unsubscribe from this group, send email to selenium-users+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/groups/opt_out.
 
 
--
Regards,
-SantoshSarma
LinkedIn | Twitter | Facebook

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To post to this group, send email to selenium-users@googlegroups.com.
To unsubscribe from this group, send email to selenium-users+unsubscribe@googlegroups.com.

Peter Gale

unread,
Jul 23, 2012, 4:14:57 PM7/23/12
to Selenium Users
If you google "iframe" and "cross-domain environments" you'll find a stack load of references that indicate this is a common problem (not just for Selenium) which can be addressed by more considerate development practices. So it seems to me that the developers are the people best placed to help you with this issue.

Do they acknowledge that they could make a change that would resolve the problem, and that it wouldn't adversely affect the functionality of the site?

If so, it seems very un-"team spirited" of them.

Have you googled "selenium iframes cross-domain environment"?

The second result turned up this link: http://code.google.com/p/selenium/issues/detail?id=2002 ... and a potential workaround.


Date: Mon, 23 Jul 2012 11:16:35 -0700
From: dan...@gmail.com
To: seleniu...@googlegroups.com
Subject: Re: [selenium-users] Selenium2 cannot located elements in iframe in cross-domain environment
To post to this group, send email to seleniu...@googlegroups.com.
To unsubscribe from this group, send email to selenium-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msg/selenium-users/-/QzPmL8Ci0IwJ.

simply_tester

unread,
Jul 23, 2012, 6:49:50 PM7/23/12
to seleniu...@googlegroups.com
Thanks for the suggestion. Let me take a look at the link you have provided and see if that may work. Thanks again.

On Monday, July 23, 2012 1:14:57 PM UTC-7, PeterJef...@Hotmail.co.uk wrote:
If you google "iframe" and "cross-domain environments" you'll find a stack load of references that indicate this is a common problem (not just for Selenium) which can be addressed by more considerate development practices. So it seems to me that the developers are the people best placed to help you with this issue.

Do they acknowledge that they could make a change that would resolve the problem, and that it wouldn't adversely affect the functionality of the site?

If so, it seems very un-"team spirited" of them.

Have you googled "selenium iframes cross-domain environment"?

The second result turned up this link: http://code.google.com/p/selenium/issues/detail?id=2002 ... and a potential workaround.


Date: Mon, 23 Jul 2012 11:16:35 -0700
From: dan...@gmail.com

simply_tester

unread,
Jul 23, 2012, 6:53:22 PM7/23/12
to seleniu...@googlegroups.com
I actually run through recommended steps in that link last week before creating this post. Unfortunately, that solution did not for me. I tried both of them. The main difference in here is that person who created that task had his FF and Chrome work fine. In my case, both of them as well as IE fail to locate the element.

Peter Gale

unread,
Jul 24, 2012, 3:22:41 AM7/24/12
to Selenium Users
That's a completely different error message so not the same problem at all.

Please start a new thread and provide all the usual stuff we ask for to let us help you (see other threads for details).


Date: Mon, 23 Jul 2012 12:31:16 -0700
From: ketu...@gmail.com
To: seleniu...@googlegroups.com
Subject: Re: [selenium-users] Selenium2 cannot located elements in iframe in cross-domain environment



I am having the same issue. I trying to type into iframe element, which is a rich text editor by running automation test. But, when I am trying to locate the element, I am getting this error.

Selenium.SeleniumException: ERROR: Command execution failure. Please search the user group at https://groups.google.com/forum/#!forum/selenium-users for error details from the log window.  The error message is: Permission denied for </*link to the webpage I am testing*/ > to set property HTMLScriptElement.type


--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To post to this group, send email to seleniu...@googlegroups.com.
To unsubscribe from this group, send email to selenium-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msg/selenium-users/-/4VJn9QjU3dQJ.

Mark Collin

unread,
Jul 24, 2012, 4:02:46 AM7/24/12
to seleniu...@googlegroups.com

Is the page externally available?

 

 

From: seleniu...@googlegroups.com [mailto:seleniu...@googlegroups.com] On Behalf Of simply_tester
Sent: 23 July 2012 23:53
To: seleniu...@googlegroups.com
Subject: Re: [selenium-users] Selenium2 cannot located elements in iframe in cross-domain environment

 

I actually run through recommended steps in that link last week before creating this post. Unfortunately, that solution did not for me. I tried both of them. The main difference in here is that person who created that task had his FF and Chrome work fine. In my case, both of them as well as IE fail to locate the element.


On Monday, July 23, 2012 3:49:50 PM UTC-7, simply_tester wrote:

Thanks for the suggestion. Let me take a look at the link you have provided and see if that may work. Thanks again.

On Monday, July 23, 2012 1:14:57 PM UTC-7, PeterJef...@Hotmail.co.uk wrote:

If you google "iframe" and "cross-domain environments" you'll find a stack load of references that indicate this is a common problem (not just for Selenium) which can be addressed by more considerate development practices. So it seems to me that the developers are the people best placed to help you with this issue.

Do they acknowledge that they could make a change that would resolve the problem, and that it wouldn't adversely affect the functionality of the site?

If so, it seems very un-"team spirited" of them.

Have you googled "selenium iframes cross-domain environment"?

The second result turned up this link: http://code.google.com/p/selenium/issues/detail?id=2002 ... and a potential workaround.

Date: Mon, 23 Jul 2012 11:16:35 -0700
From: dan...@gmail.com


Subject: Re: [selenium-users] Selenium2 cannot located elements in iframe in cross-domain environment

Hi,

Thanks for replying. The problem is that devs won't make such change in order for me to test, I need to find a solution to test the way it is :)

Thanks,


On Saturday, July 21, 2012 11:15:18 PM UTC-7, SantoshSarma wrote:

Yes that is true. I also faced the same problem.

 

Ask your developers to make the iframe also in same domain. I think it is small change in JS for developers.

On Sat, Jul 21, 2012 at 1:22 PM, Peter Gale <peterjef...@hotmail.co.uk> wrote:

Do you get the same problem when testing the page manually?

Date: Fri, 20 Jul 2012 17:59:21 -0700
From: dan...@gmail.com


Subject: [selenium-users] Selenium2 cannot located elements in iframe in cross-domain environment



Hi,

I'm running into an issue where I get redirected to another domain page where all the elementes are inside the iframe and my selenium2 script only finds first element out of x amount of elements specified. After that script fails since next element cannot be located. Ii've tried to locate other elements using all sorts of locators supported in Selenium2, as well as, using JavascriptExecutor - but same failure. One web-dev told me it could be possible due to iframes and cross-domain environment.
 
Please recommend a solution. 

Thanks

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.

To post to this group, send email to seleniu...@googlegroups.com.
To unsubscribe from this group, send email to selenium-user...@googlegroups.com.


To view this discussion on the web visit https://groups.google.com/d/msg/selenium-users/-/_aBd7HSRr3sJ.
For more options, visit https://groups.google.com/groups/opt_out.
 
 


--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.

To post to this group, send email to seleniu...@googlegroups.com.
To unsubscribe from this group, send email to selenium-user...@googlegroups.com.


For more options, visit https://groups.google.com/groups/opt_out.
 
 



 

--

Regards,
-SantoshSarma
LinkedIn | Twitter | Facebook

 


--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.

To post to this group, send email to seleniu...@googlegroups.com.
To unsubscribe from this group, send email to selenium-user...@googlegroups.com.


To view this discussion on the web visit https://groups.google.com/d/msg/selenium-users/-/QzPmL8Ci0IwJ.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

--

You received this message because you are subscribed to the Google Groups "Selenium Users" group.

To post to this group, send email to seleniu...@googlegroups.com.
To unsubscribe from this group, send email to selenium-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msg/selenium-users/-/3zmwSZjmZu0J.

Bug buster

unread,
Jul 24, 2012, 9:45:25 AM7/24/12
to seleniu...@googlegroups.com


Actually, the error the error I got, while running the automation test diverted my to this forum.

On Tuesday, July 24, 2012 2:22:41 AM UTC-5, PeterJef...@Hotmail.co.uk wrote:
That's a completely different error message so not the same problem at all.

Please start a new thread and provide all the usual stuff we ask for to let us help you (see other threads for details).


Date: Mon, 23 Jul 2012 12:31:16 -0700
From: ketu...@gmail.com

Subject: Re: [selenium-users] Selenium2 cannot located elements in iframe in cross-domain environment



I am having the same issue. I trying to type into iframe element, which is a rich text editor by running automation test. But, when I am trying to locate the element, I am getting this error.

Selenium.SeleniumException: ERROR: Command execution failure. Please search the user group at https://groups.google.com/forum/#!forum/selenium-users for error details from the log window.  The error message is: Permission denied for </*link to the webpage I am testing*/ > to set property HTMLScriptElement.type

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To post to this group, send email to selenium-users@googlegroups.com.
To unsubscribe from this group, send email to selenium-users+unsubscribe@googlegroups.com.

Mark Collin

unread,
Jul 24, 2012, 9:47:45 AM7/24/12
to seleniu...@googlegroups.com

That’s nice.

 

I would suggest you start a new thread outlining your problem and providing us with your test code and the HTML of the site you are testing.

 

This will get you a much faster and more relevant response.

 

From: seleniu...@googlegroups.com [mailto:seleniu...@googlegroups.com] On Behalf Of Bug buster
Sent: 24 July 2012 14:45
To: seleniu...@googlegroups.com
Subject: Re: [selenium-users] Selenium2 cannot located elements in iframe in cross-domain environment

 


Actually, the error the error I got, while running the automation test diverted my to this forum.

On Tuesday, July 24, 2012 2:22:41 AM UTC-5, PeterJef...@Hotmail.co.uk wrote:

That's a completely different error message so not the same problem at all.

Please start a new thread and provide all the usual stuff we ask for to let us help you (see other threads for details).

Date: Mon, 23 Jul 2012 12:31:16 -0700
From: ketu...@gmail.com


Subject: Re: [selenium-users] Selenium2 cannot located elements in iframe in cross-domain environment



I am having the same issue. I trying to type into iframe element, which is a rich text editor by running automation test. But, when I am trying to locate the element, I am getting this error.

Selenium.SeleniumException: ERROR: Command execution failure. Please search the user group at https://groups.google.com/forum/#!forum/selenium-users for error details from the log window.  The error message is: Permission denied for </*link to the webpage I am testing*/ > to set property HTMLScriptElement.type

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.

To post to this group, send email to seleniu...@googlegroups.com.
To unsubscribe from this group, send email to selenium-user...@googlegroups.com.


To view this discussion on the web visit https://groups.google.com/d/msg/selenium-users/-/4VJn9QjU3dQJ.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

--

You received this message because you are subscribed to the Google Groups "Selenium Users" group.

To post to this group, send email to seleniu...@googlegroups.com.
To unsubscribe from this group, send email to selenium-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msg/selenium-users/-/zEPZzhhVIhQJ.

simply_tester

unread,
Jul 24, 2012, 4:26:33 PM7/24/12
to seleniu...@googlegroups.com
Hi,

I've done this part, but unfortunately, it can only see first element to be located.

Thanks,

On Tuesday, July 24, 2012 2:38:39 AM UTC-7, Mohit wrote:
I also faced the same problem but when i switched to the frame then it worked for me.
Try to switch as below:

driver.switchTo().frame(Webelement);



On Tuesday, July 24, 2012 1:32:46 PM UTC+5:30, Mark Collin wrote:

Is the page externally available?

 

 

From: selenium-users@googlegroups.com [mailto:selenium-users@googlegroups.com] On Behalf Of simply_tester
Sent: 23 July 2012 23:53
To: selenium-users@googlegroups.com
Subject: Re: [selenium-users] Selenium2 cannot located elements in iframe in cross-domain environment

 

I actually run through recommended steps in that link last week before creating this post. Unfortunately, that solution did not for me. I tried both of them. The main difference in here is that person who created that task had his FF and Chrome work fine. In my case, both of them as well as IE fail to locate the element.

On Monday, July 23, 2012 3:49:50 PM UTC-7, simply_tester wrote:

Thanks for the suggestion. Let me take a look at the link you have provided and see if that may work. Thanks again.

On Monday, July 23, 2012 1:14:57 PM UTC-7, PeterJef...@Hotmail.co.uk wrote:

If you google "iframe" and "cross-domain environments" you'll find a stack load of references that indicate this is a common problem (not just for Selenium) which can be addressed by more considerate development practices. So it seems to me that the developers are the people best placed to help you with this issue.

Do they acknowledge that they could make a change that would resolve the problem, and that it wouldn't adversely affect the functionality of the site?

If so, it seems very un-"team spirited" of them.

Have you googled "selenium iframes cross-domain environment"?

The second result turned up this link: http://code.google.com/p/selenium/issues/detail?id=2002 ... and a potential workaround.

Date: Mon, 23 Jul 2012 11:16:35 -0700
From: dan...@gmail.com


Subject: Re: [selenium-users] Selenium2 cannot located elements in iframe in cross-domain environment

Hi,

Thanks for replying. The problem is that devs won't make such change in order for me to test, I need to find a solution to test the way it is :)

Thanks,


On Saturday, July 21, 2012 11:15:18 PM UTC-7, SantoshSarma wrote:

Yes that is true. I also faced the same problem.

 

Ask your developers to make the iframe also in same domain. I think it is small change in JS for developers.

On Sat, Jul 21, 2012 at 1:22 PM, Peter Gale <peterjef...@hotmail.co.uk> wrote:

Do you get the same problem when testing the page manually?

Date: Fri, 20 Jul 2012 17:59:21 -0700
From: dan...@gmail.com


Subject: [selenium-users] Selenium2 cannot located elements in iframe in cross-domain environment



Hi,

I'm running into an issue where I get redirected to another domain page where all the elementes are inside the iframe and my selenium2 script only finds first element out of x amount of elements specified. After that script fails since next element cannot be located. Ii've tried to locate other elements using all sorts of locators supported in Selenium2, as well as, using JavascriptExecutor - but same failure. One web-dev told me it could be possible due to iframes and cross-domain environment.
 
Please recommend a solution. 

Thanks

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.

To post to this group, send email to selenium-users@googlegroups.com.
To unsubscribe from this group, send email to selenium-users+unsubscribe@googlegroups.com.


To view this discussion on the web visit https://groups.google.com/d/msg/selenium-users/-/_aBd7HSRr3sJ.
For more options, visit https://groups.google.com/groups/opt_out.
 
 


--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.

To post to this group, send email to selenium-users@googlegroups.com.
To unsubscribe from this group, send email to selenium-users+unsubscribe@googlegroups.com.


For more options, visit https://groups.google.com/groups/opt_out.
 
 



 

--

Regards,
-SantoshSarma
LinkedIn | Twitter | Facebook

 


--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.

To post to this group, send email to selenium-users@googlegroups.com.
To unsubscribe from this group, send email to selenium-users+unsubscribe@googlegroups.com.


To view this discussion on the web visit https://groups.google.com/d/msg/selenium-users/-/QzPmL8Ci0IwJ.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.

To post to this group, send email to selenium-users@googlegroups.com.
To unsubscribe from this group, send email to selenium-users+unsubscribe@googlegroups.com.

simply_tester

unread,
Jul 24, 2012, 4:39:26 PM7/24/12
to seleniu...@googlegroups.com
Hi Mark,

Yes. This is for Barnes & Noble Web Reader - mynook.barnesandnoble.com. In order to see the problem, you'll have to create an account and open any sample book (it's free).

Thanks, 

On Tuesday, July 24, 2012 1:02:46 AM UTC-7, Mark Collin wrote:

Is the page externally available?

 

 

From: selenium-users@googlegroups.com [mailto:selenium-users@googlegroups.com] On Behalf Of simply_tester
Sent: 23 July 2012 23:53
To: selenium-users@googlegroups.com
Subject: Re: [selenium-users] Selenium2 cannot located elements in iframe in cross-domain environment

 

I actually run through recommended steps in that link last week before creating this post. Unfortunately, that solution did not for me. I tried both of them. The main difference in here is that person who created that task had his FF and Chrome work fine. In my case, both of them as well as IE fail to locate the element.

On Monday, July 23, 2012 3:49:50 PM UTC-7, simply_tester wrote:

Thanks for the suggestion. Let me take a look at the link you have provided and see if that may work. Thanks again.

On Monday, July 23, 2012 1:14:57 PM UTC-7, PeterJef...@Hotmail.co.uk wrote:

If you google "iframe" and "cross-domain environments" you'll find a stack load of references that indicate this is a common problem (not just for Selenium) which can be addressed by more considerate development practices. So it seems to me that the developers are the people best placed to help you with this issue.

Do they acknowledge that they could make a change that would resolve the problem, and that it wouldn't adversely affect the functionality of the site?

If so, it seems very un-"team spirited" of them.

Have you googled "selenium iframes cross-domain environment"?

The second result turned up this link: http://code.google.com/p/selenium/issues/detail?id=2002 ... and a potential workaround.

Date: Mon, 23 Jul 2012 11:16:35 -0700
From: dan...@gmail.com


Subject: Re: [selenium-users] Selenium2 cannot located elements in iframe in cross-domain environment

Hi,

Thanks for replying. The problem is that devs won't make such change in order for me to test, I need to find a solution to test the way it is :)

Thanks,


On Saturday, July 21, 2012 11:15:18 PM UTC-7, SantoshSarma wrote:

Yes that is true. I also faced the same problem.

 

Ask your developers to make the iframe also in same domain. I think it is small change in JS for developers.

On Sat, Jul 21, 2012 at 1:22 PM, Peter Gale <peterjef...@hotmail.co.uk> wrote:

Do you get the same problem when testing the page manually?

Date: Fri, 20 Jul 2012 17:59:21 -0700
From: dan...@gmail.com


Subject: [selenium-users] Selenium2 cannot located elements in iframe in cross-domain environment



Hi,

I'm running into an issue where I get redirected to another domain page where all the elementes are inside the iframe and my selenium2 script only finds first element out of x amount of elements specified. After that script fails since next element cannot be located. Ii've tried to locate other elements using all sorts of locators supported in Selenium2, as well as, using JavascriptExecutor - but same failure. One web-dev told me it could be possible due to iframes and cross-domain environment.
 
Please recommend a solution. 

Thanks

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.

To post to this group, send email to selenium-users@googlegroups.com.
To unsubscribe from this group, send email to selenium-users+unsubscribe@googlegroups.com.


To view this discussion on the web visit https://groups.google.com/d/msg/selenium-users/-/_aBd7HSRr3sJ.
For more options, visit https://groups.google.com/groups/opt_out.
 
 


--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.

To post to this group, send email to selenium-users@googlegroups.com.
To unsubscribe from this group, send email to selenium-users+unsubscribe@googlegroups.com.


For more options, visit https://groups.google.com/groups/opt_out.
 
 



 

--

Regards,
-SantoshSarma
LinkedIn | Twitter | Facebook

 


--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.

To post to this group, send email to selenium-users@googlegroups.com.
To unsubscribe from this group, send email to selenium-users+unsubscribe@googlegroups.com.


To view this discussion on the web visit https://groups.google.com/d/msg/selenium-users/-/QzPmL8Ci0IwJ.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.

To post to this group, send email to selenium-users@googlegroups.com.
To unsubscribe from this group, send email to selenium-users+unsubscribe@googlegroups.com.

Peter Gale

unread,
Jul 24, 2012, 6:27:23 PM7/24/12
to Selenium Users
Unfortnately, many people draw the line at creating yet another user account.


Date: Tue, 24 Jul 2012 13:39:26 -0700
From: dan...@gmail.com
To: seleniu...@googlegroups.com
To post to this group, send email to seleniu...@googlegroups.com.
To unsubscribe from this group, send email to selenium-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msg/selenium-users/-/M5_B-lq3tD0J.

simply_tester

unread,
Jul 27, 2012, 2:18:10 PM7/27/12
to seleniu...@googlegroups.com
Unfortunately... Well, I'll try a different route. Please see below for more info on the issue.

- user logs in to the site - that's one URL (https) - user is presented with the page where content can be selected
- user selects content to be displayed - gets redirected to a different URL (https) that has an iframe, which contains all the elements I need (from here, selenium can only detect 1st element out of 4 specified in the selenium script. All elements are located under the same <div>). Please see below for ex. Elements I'm looking for are in red color.

Ex.
<html>
  <head></head>
     <body>
         <iframe>
              #document
                  <html>
                      <head>...</head>
                           <body>
                               <table>
                                    <tbody>
                                        <tr></tr>
                                        <tr></tr>
                                        <tr>
                                           <td></td>
                                           <td>
                                             <div></div>
                                             <div></div>
                                             <div>
                                               <span element1></span>
                                               <span element2></span>
                                               <span> element3</span>
                                               <span> element4</span>
                                              <div>


On Tuesday, July 24, 2012 3:27:23 PM UTC-7, PeterJef...@Hotmail.co.uk wrote:
Unfortnately, many people draw the line at creating yet another user account.


Date: Tue, 24 Jul 2012 13:39:26 -0700
From: dan...@gmail.com

simply_tester

unread,
Jul 31, 2012, 7:42:55 PM7/31/12
to seleniu...@googlegroups.com
Hi Mark,

Here is a way to see this issue without creating an account:

- go to mynook.barnesandnoble.com
- paste this URL: https://nook.com/read/Race/Clive-Cussler/?ean=9781101547731

This will open a sample of the book in a different domain. There you'll be able to find this iframe with the elements I'm trying to locate for my test (in red below).
EX.
<html>
  <head></head>
     <body>
         <iframe>
              #document
                  <html>
                      <head>...</head>
                           <body>
                               <table>
                              
      <tbody>
                                        <tr></tr>
                                        <tr></tr>
                                        <tr>
                                           <td></td>
                                           <td>
                                             <div></div>
                                             <div></div>
                                             <div>
                                               <span element1></span>
                                               <span element2></span>
                                               <span> element3</span>
                                               <span> element4</span>
                                              <div>

thanks,


On Tuesday, July 24, 2012 1:02:46 AM UTC-7, Mark Collin wrote:

Is the page externally available?

 

 

From: selenium-users@googlegroups.com [mailto:selenium-users@googlegroups.com] On Behalf Of simply_tester
Sent: 23 July 2012 23:53
To: selenium-users@googlegroups.com
Subject: Re: [selenium-users] Selenium2 cannot located elements in iframe in cross-domain environment

 

I actually run through recommended steps in that link last week before creating this post. Unfortunately, that solution did not for me. I tried both of them. The main difference in here is that person who created that task had his FF and Chrome work fine. In my case, both of them as well as IE fail to locate the element.

On Monday, July 23, 2012 3:49:50 PM UTC-7, simply_tester wrote:

Thanks for the suggestion. Let me take a look at the link you have provided and see if that may work. Thanks again.

On Monday, July 23, 2012 1:14:57 PM UTC-7, PeterJef...@Hotmail.co.uk wrote:

If you google "iframe" and "cross-domain environments" you'll find a stack load of references that indicate this is a common problem (not just for Selenium) which can be addressed by more considerate development practices. So it seems to me that the developers are the people best placed to help you with this issue.

Do they acknowledge that they could make a change that would resolve the problem, and that it wouldn't adversely affect the functionality of the site?

If so, it seems very un-"team spirited" of them.

Have you googled "selenium iframes cross-domain environment"?

The second result turned up this link: http://code.google.com/p/selenium/issues/detail?id=2002 ... and a potential workaround.

Date: Mon, 23 Jul 2012 11:16:35 -0700
From: dan...@gmail.com


Subject: Re: [selenium-users] Selenium2 cannot located elements in iframe in cross-domain environment

Hi,

Thanks for replying. The problem is that devs won't make such change in order for me to test, I need to find a solution to test the way it is :)

Thanks,


On Saturday, July 21, 2012 11:15:18 PM UTC-7, SantoshSarma wrote:

Yes that is true. I also faced the same problem.

 

Ask your developers to make the iframe also in same domain. I think it is small change in JS for developers.

On Sat, Jul 21, 2012 at 1:22 PM, Peter Gale <peterjef...@hotmail.co.uk> wrote:

Do you get the same problem when testing the page manually?

Date: Fri, 20 Jul 2012 17:59:21 -0700
From: dan...@gmail.com


Subject: [selenium-users] Selenium2 cannot located elements in iframe in cross-domain environment



Hi,

I'm running into an issue where I get redirected to another domain page where all the elementes are inside the iframe and my selenium2 script only finds first element out of x amount of elements specified. After that script fails since next element cannot be located. Ii've tried to locate other elements using all sorts of locators supported in Selenium2, as well as, using JavascriptExecutor - but same failure. One web-dev told me it could be possible due to iframes and cross-domain environment.
 
Please recommend a solution. 

Thanks

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.

To post to this group, send email to selenium-users@googlegroups.com.
To unsubscribe from this group, send email to selenium-users+unsubscribe@googlegroups.com.


To view this discussion on the web visit https://groups.google.com/d/msg/selenium-users/-/_aBd7HSRr3sJ.
For more options, visit https://groups.google.com/groups/opt_out.
 
 


--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.

To post to this group, send email to selenium-users@googlegroups.com.
To unsubscribe from this group, send email to selenium-users+unsubscribe@googlegroups.com.


For more options, visit https://groups.google.com/groups/opt_out.
 
 



 

--

Regards,
-SantoshSarma
LinkedIn | Twitter | Facebook

 


--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.

To post to this group, send email to selenium-users@googlegroups.com.
To unsubscribe from this group, send email to selenium-users+unsubscribe@googlegroups.com.


To view this discussion on the web visit https://groups.google.com/d/msg/selenium-users/-/QzPmL8Ci0IwJ.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.

To post to this group, send email to selenium-users@googlegroups.com.
To unsubscribe from this group, send email to selenium-users+unsubscribe@googlegroups.com.

Reply all
Reply to author
Forward
0 new messages