On Thu, Sep 29, 2011 at 3:30 PM, <[email protected]> wrote: > Send BangPypers mailing list submissions to > [email protected] > > 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 > [email protected] > > You can reach the person managing the list at > [email protected] > > 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 <[email protected]> > To: [email protected] > Subject: [BangPypers] Howto run python selenium script on remote > server > Message-ID: > <canr2jhgy7r0x21d5ybxwyhnpw1iqrxyae3kjnq-9_yawwkk...@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 <[email protected]> > To: Bangalore Python Users Group - India <[email protected]> > Subject: Re: [BangPypers] Howto run python selenium script on remote > server > Message-ID: > <cambktg+s8xdix4umofrluhitpggraulguckzs6foo6orh9y...@mail.gmail.com> > Content-Type: text/plain; charset=ISO-8859-1 > > Hi, > > On Thu, Sep 29, 2011 at 2:26 PM, Saju M <[email protected]> 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: [email protected] > Blog: http://benignbala.wordpress.com/ > > > ------------------------------ > > _______________________________________________ > BangPypers mailing list > [email protected] > http://mail.python.org/mailman/listinfo/bangpypers > > > End of BangPypers Digest, Vol 49, Issue 32 > ****************************************** > _______________________________________________ BangPypers mailing list [email protected] http://mail.python.org/mailman/listinfo/bangpypers
