- orestis125
- Posts : 3
Join date : 2012-09-25
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
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
- popshaAmateur
- Posts : 60
Join date : 2012-04-14
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.
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.
- orestis125
- Posts : 3
Join date : 2012-09-25
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.
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.
- popshaAmateur
- Posts : 60
Join date : 2012-04-14
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.
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.
Permissions in this forum:
You cannot reply to topics in this forum
|
|