from selenium import webdriver from selenium.common.exceptions import NoSuchElementException from selenium.webdriver.common.keys import Keys import time
browser = webdriver.Firefox() # Get local session of firefox browser.get("http://www.yahoo.com") # Load page assert"Yahoo!"in browser.title elem = browser.find_element_by_name("p") # Find the query box elem.send_keys("seleniumhq" + Keys.RETURN) time.sleep(0.2) # Let the page load, will be added to the API try: browser.find_element_by_xpath("//a[contains(@href,'http://seleniumhq.org')]") except NoSuchElementException: assert0, "can't find seleniumhq" browser.close()
(运行过程中如果出现错误:
WebDriverException: Message: u'Unexpected error launching Internet Explorer.
Protected Mode settings are not the same for all zones. Enable Protected Mo
de must be set to the same value (enabled or disabled) for all zones.'
在本地服务器通过php创建sqlite数据库,或者通过工具比如sqliteadmin创建的sqlite数据库,使用是正常的,但如果上传到服务器上,再通过php打开会现错误:Error: database disk image is malformed, 提示你的数据库文件有损坏,以前一直找不到原因,今天从同事那儿得到解决办法,原来是因为自己使用FTP工具 filezilla上传数据库文件时没有更改传输模式,我使用的是默认,改为二进制模式即可解决此问题,另外,你把数据库压缩成zip格式后,再上传也能解决此问题。
cd ~ wget http://pecl.php.net/get/sqlite3-0.6.tgz tar -zxf sqlite3-0.6.tgz cd sqlite3-0.6/ phpize ./configure --with-php-config=/usr/local/php/bin/php-config make make install /etc/init.d/httpd restart
安装完成后如果还是不行,需要修改php.ini( vi /usr/local/php/etc/php.ini)一个配置 [在命令下查看配置文件路径的方法: php -i | grep 'Configuration File']
1 2 3 4
; Directory in which the loadable extensions (modules) reside. extension_dir = "/usr/local/php/lib/php/extensions/no-debug-non-zts-20060613/" extension = "memcache.so" extension = "pdo_mysql.so"
修改为
1 2 3 4 5
; Directory in which the loadable extensions (modules) reside. extension_dir = "/usr/local/php/lib/php/extensions/no-debug-non-zts-20060613/" extension = "memcache.so" extension = "pdo_mysql.so" extension = "sqlite3.so"
sqlite3 数据库错误,Error: database disk image is malformed 目前搜索的解决的方案都说无法解决。只能通过备份解决,此问题是在本地测试正常,上传到服务器时出现此错误,你可以在本地通过备份操作,先导出数据库为sql文件,然后上传sql文件,在服务器端重新创建。
但总是失败 can not load modules/mod_wsgi.so into server ,最后是把xampp中的apache替换成 http://www.apachelounge.com/download/ 这个网站上的相应版本的apache,然后才成功。 【Apache2.4.4需要VC10库支持】
WSGIScriptAlias /googlescrape "D:/workfiles/wwwroot/googlescrape/" <Directory "D:/workfiles/wwwroot/googlescrape"> Orderallow,deny Allow from all </Directory>
You just installed Django's auth system, which means you don't have any superuse rs defined. Would you liketocreateone now? (yes/no): yes Username (leave blank to use 'administrator'): admin Email address: xxx@gmail.com Password: Password (again): Superuser created successfully. Installing custom SQL ... Installing indexes ... Installed 0 object(s) from0 fixture(s)