[BangPypers] BangPypers Digest, Vol 49, Issue 32

Saju M sajuptpm at gmail.com
Thu Sep 29 13:31:03 CEST 2011


On Thu, Sep 29, 2011 at 3:30 PM,  <bangpypers-request at python.org> wrote:
> Send BangPypers mailing list submissions to
>        bangpypers at python.org
>
> To subscribe or unsubscribe via the World Wide Web, visit
>        http://mail.python.org/mailman/listinfo/bangpypers
> or, via email, send a message with subject or body 'help' to
>        bangpypers-request at python.org
>
> You can reach the person managing the list at
>        bangpypers-owner at python.org
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of BangPypers digest..."
>
>
> Today's Topics:
>
>   1. Howto run python selenium script on remote server (Saju M)
>   2. Re: Howto run python selenium script on remote server
>      (Balachandran Sivakumar)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Thu, 29 Sep 2011 14:26:24 +0530
> From: Saju M <sajuptpm at gmail.com>
> To: bangpypers at python.org
> Subject: [BangPypers] Howto run python selenium script on remote
>        server
> Message-ID:
>        <CANR2JHgy7R0X21d5ybxwYHnPw1iqRXyaE3KjnQ-9_yaWWkK5nA at mail.gmail.com>
> Content-Type: text/plain; charset=ISO-8859-1
>
> Hi,
> I created a script using selenium and its working in my local system.
> But when i trying to run it in remote machine (Centos), getting error.
> This script should need to open a firefox browser. So i think the the
> script could not open the firefox browser on remote machine(Server).
> Have any way to run it on remote machine(Server)?????.
>
>
> Traceback (most recent call last):
>  File "script.py", line 34, in <module>
>    s = Search()
>  File "script.py", line 8, in __init__
>    self.driver  = webdriver.Firefox()
>  File "/home/madfishe/env6/lib/python2.6/site-packages/selenium-2.7.0-py2.6.egg/selenium/webdriver/firefox/webdriver.py",
> line 46, in __init__
>    self.binary, timeout),
>  File "/home/madfishe/env6/lib/python2.6/site-packages/selenium-2.7.0-py2.6.egg/selenium/webdriver/firefox/extension_connection.py",
> line 46, in __init__
>    self.binary.launch_browser(self.profile)
>  File "/home/madfishe/env6/lib/python2.6/site-packages/selenium-2.7.0-py2.6.egg/selenium/webdriver/firefox/firefox_binary.py",
> line 44, in launch_browser
>    self._wait_until_connectable()
>  File "/home/madfishe/env6/lib/python2.6/site-packages/selenium-2.7.0-py2.6.egg/selenium/webdriver/firefox/firefox_binary.py",
> line 87, in _wait_until_connectable
>    raise WebDriverException("Can't load the profile. Profile Dir :
> %s" % self.profile.path)
> selenium.common.exceptions.WebDriverException: Message: "Can't load
> the profile. Profile Dir : /tmp/tmpWmkFsy"
>
> ------------------------------------- script
>
> from selenium import webdriver
> import BeautifulSoup
> class Search:
>        def __init__(self):
>                self.url ='http://www.google.co.in'
>                self.search_url = None
>                self.driver  = webdriver.Firefox()
>
>        def search(self, search_query, search_location=None):
>                if search_query:
>                        self.search_url = "%s/search?q=%s" %(self.url, search_query)
>                        self.driver.get(self.search_url)
>                        search_fld = self.driver.find_element_by_id("lst-ib")
>                        #help(search_fld)
>                        search_btn = self.driver.find_element_by_name("btnK")
>                        search_btn.submit()
>                        if search_location:
>                                self.change_location(search_location)
>                        html = self.driver.page_source
>                        soup=BeautifulSoup.BeautifulSoup(html)
>                        result = soup.findAll(attrs={"class" : "l"})
>                        return result
>
>        def change_location(self, new_location):
>                self.driver.find_element_by_id("toggle_location_link").click()
>                self.driver.find_element_by_id("lc-input").send_keys(new_location)
>                els = self.driver.find_elements_by_tag_name("input")
>                set_el = [el for el in els if el.get_attribute('value')=='Set']
>                #print "-------value-----", set_el[0].get_attribute('value')
>                set_el[0].submit()
> s = Search()
> print"------search result------", s.search('python', 'kerala')
>
>
> ------------------------------
>
> Message: 2
> Date: Thu, 29 Sep 2011 14:50:45 +0530
> From: Balachandran Sivakumar <benignbala at gmail.com>
> To: Bangalore Python Users Group - India <bangpypers at python.org>
> Subject: Re: [BangPypers] Howto run python selenium script on remote
>        server
> Message-ID:
>        <CAMbkTg+S8XdiX4umOfRLUhitPgGRaULGucKzs6foO6Orh9yvLw at mail.gmail.com>
> Content-Type: text/plain; charset=ISO-8859-1
>
> Hi,
>
> On Thu, Sep 29, 2011 at 2:26 PM, Saju M <sajuptpm at gmail.com> wrote:
>> Hi,
>> I created a script using selenium and its working in my local system.
>> But when i trying to run it in remote machine (Centos), getting error.
>> This script should need to open a firefox browser. So i think the the
>> script could not open the firefox browser on remote machine(Server).
>> Have any way to run it on remote machine(Server)?????.
>>
>
>       Does the remote machine have firefox installed the the default
> path ? That's one thing that can go wrong
>
>
>> selenium.common.exceptions.WebDriverException: Message: "Can't load
>> the profile. Profile Dir : /tmp/tmpWmkFsy"
>>
>
>       The error is with the firefox profile folder. You can pass it
> as a parameter. I used to use the RC, and it had a
> -fireforeProfileTemplate parameter to which you pass on the path to
> the profile folder. There must something like that for WebDriver as
> well. Thanks
>
>
>
> --
> Thank you
> Balachandran Sivakumar
>
> Arise Awake and stop not till the goal is reached.
> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?- Swami Vivekananda
>
> Mail: benignbala at gmail.com
> Blog: http://benignbala.wordpress.com/
>
>
> ------------------------------
>
> _______________________________________________
> BangPypers mailing list
> BangPypers at python.org
> http://mail.python.org/mailman/listinfo/bangpypers
>
>
> End of BangPypers Digest, Vol 49, Issue 32
> ******************************************
>


More information about the BangPypers mailing list