Selenium Forum: Functional And Regression Testing Tool.
Would you like to react to this message? Create an account in a few clicks or log in to continue.
Search
Display results as :
Advanced Search
Latest topics
AEM Training | Free Online DemoWed Apr 21, 2021 5:45 pmazharuddin
c# PageFactory - issue initializing elementsFri Nov 01, 2019 8:40 pmthegoatboy
Selenium making automatic connection to random urlsMon Jul 08, 2019 12:58 pmrepairtechsolutions1
How can we design the custom framework in Selenium RCMon Jun 24, 2019 2:26 pmrandybonnettes
What are the new features in Selenium 3.0Tue Jun 18, 2019 5:37 pmpappyvicky
What are you using Selenium for? Fri Apr 12, 2019 3:52 amzhl
LIMITATIONS OF SELENIUMWed Apr 10, 2019 11:23 amswara
Navigation
 Portal
 Index
 Memberlist
 Profile
 FAQ
 Search

Go down
avatar
orestis125
Posts : 3
Join date : 2012-09-25

Questions: Get element from another domain, load page without blocking Empty Questions: Get element from another domain, load page without blocking

Tue Sep 25, 2012 4:13 am
Heya everyone,

I'm new to this forum so please forgive me if I'm posting this in the wrong place. I've recently started working with the selenium web driver in java and I have a couple of questions for which I can't seem to find any answer on the web.

My first question is whether there is a way to get an element (Specifically by xpath) of a page from another domain. For example the browser's current URL is "google.com" and I need to get an element from "yahoo.com" without navigating to yahoo. If this is possible, how will I do that? If there is no direct way of doing this, is it possible to invisibly create a new web driver? For example if I can create a web driver and navigate to "yahoo.com" with an invisible browser I would be able to achieve this.

My second question is whether there is a way to stop blocking the program when the browser loads a page. Currently my program freezes until the page finishes loading. I've tried using threads but that results in other problems. If it's possible, how will I achieve this?

I would greatly appreciate it if someone could help me out and provide me with some information

Thank you very much,
Orestis
avatar
popsha
Amateur
Amateur
Posts : 60
Join date : 2012-04-14

Questions: Get element from another domain, load page without blocking Empty Re: Questions: Get element from another domain, load page without blocking

Tue Sep 25, 2012 8:26 am
Hi Orestis

Answer 1:

Cannot find the xpath of an element without navigating to specified webpage. But, can use HtmlUnitDriver to instantiate webdriver invisibly and fast. Use below link for further reference
http://seleniumhq.org/docs/03_webdriver.html#htmlunit-driver

Answer 2:
Use implicit wait option for page loading. Often usage of threads lead to weak design of framework.
avatar
orestis125
Posts : 3
Join date : 2012-09-25

Questions: Get element from another domain, load page without blocking Empty Re: Questions: Get element from another domain, load page without blocking

Wed Sep 26, 2012 7:30 pm
Thank you for your reply,

Everything works perfectly now thanks to your suggestions. However I've noticed that HtmlUnitDriver is extremely slow (takes about 20 seconds to fully load a page) compared to my FirefoxDriver.

Any idea what might be causing this? Is there a way to speed it up? (Maybe a way to disable the loading of images or stop loading page when specific element has been found)

Thank you very much for your help,
I greatly appreciate it

Orestis

Edit: Also, I know they are just warnings, but I keep getting "WARNING: Obsolete content type encountered" and similar messages. Is there a way to disable them? Makes it harder to debug using the console window.
avatar
popsha
Amateur
Amateur
Posts : 60
Join date : 2012-04-14

Questions: Get element from another domain, load page without blocking Empty Re: Questions: Get element from another domain, load page without blocking

Thu Sep 27, 2012 1:26 pm
Hi Orestis, thanks for your appreciation.

FirefoxDriver is the fastest comparable to others, speeding up it, results in vain. Since WebDriver rely on native events, it is not possible to speed up loading time.In your scenario, only reducing the loading time in application would help you.

Obsolete content type encountered - occurs in HtmlUnitDriver execution which is least bothered as it comes in recent versions.

My suggestion is that, Use isDisplayed() in try-catch block for the web element you search and skip to required event.
Sponsored content

Questions: Get element from another domain, load page without blocking Empty Re: Questions: Get element from another domain, load page without blocking

Back to top
Permissions in this forum:
You cannot reply to topics in this forum