2017年6月12日 星期一

[UFT] UFT連結MySQL Server

UFT本身內建只支援連結SQL Server,需安裝額外套件才可連結MySQL Server

安裝步驟:

1.安裝Appserv
https://www.appserv.org/en/

這是一個apache+mysql+phpmyadmin的整合包
其實這步驟的目的只是為了要安裝mysql在本機端,反正都要裝mysql了不如一次到位,還有phpmyadmin可以操作本機端的mysql來測試

2.安裝ODBC driver
https://dev.mysql.com/doc/connector-odbc/en/connector-odbc-installation-binary-windows-installer.html

一定要先安裝mysql後再安裝套件,不然會一直出錯無法使用(原因不明)
途中會出現兩次錯誤,ingore即可
(ps.要裝32bit版本)


UFT使用流程:

1. 左邊ToolBox選"Open Connection"拖拉進Test Flow中
2. "Open Connection"的"Connection string"欄位中選"Edit connection string"

3. 選"ODBC"後按右邊的板手

4. 選"Mange ODBC Data Source"

5. 按"Add" 並選擇"MySQL ODBC 5.3 Unicode Driver"
(如果套件安裝失敗,這邊選MySQL時會出錯,需要回頭重新安裝套件)

6. 填入Data Source以及登入的帳號密碼

7. 按"Test Connection"確認是否可以正常連線,如顯示"Connected"即表示連線正確可開始使用



2017年6月5日 星期一

[RobotFarmework][Mac] OS X 10.12使用RIDE

http://imsardine.simplbug.com/note/wxpython/install-osx.html#10.10-el-capitan

可能會遇到

https://forum.openframeworks.cc/t/quicktime-quicktime-h-file-not-found/24494/2

2016年5月26日 星期四

[ios] 讓app可以使用http連線

http://www.appcoda.com.tw/json-data-taipei-tutorial/

編者按:App傳輸安全(App Transport Security,簡稱ATS)是iOS9的新特性。這個功能的目的是透過一些最佳配置的強化來改善App與網頁服務間的連線安全。其中一項是安全連線的使用。有了ATS,所有的網路要求要透過HTTPS來傳送。倘若你使用HTTP來做網路連結,ATS會封鎖需求並顯示錯誤。要解決這個問題,你應該透過HTTPS去帶HTTP來載入一個網路請求,這是Apple的要求。不過,倘若你要對應的網站不是你所能控制的,而無法符合ATS需求,其中一種可能的解決方案就是退出App傳輸安全。要這麼做的話,你需要在你的App的Info.plist加上一個key來關掉ATS。

http://stackoverflow.com/questions/31254725/transport-security-has-blocked-a-cleartext-http

2016年5月24日 星期二

[sqlite] Mysql 轉 sqlite

http://stackoverflow.com/questions/3890518/convert-mysql-to-sqlite


  $ gem install sequel mysql sqlite3 
  $ sequel mysql://user:password@host/database -C sqlite://db.sqlite

2015年12月2日 星期三

2015年10月28日 星期三

[python] BeautifulSoup 出現亂碼

http://stackoverflow.com/questions/7219361/python-and-beautifulsoup-encoding-issues url = "http://ocg.xpg.jp/search/search.fcgi?CardNo=1Record=1" res = requests.get(url, verify=False) content = res.content soup = BeautifulSoup(content.decode('Shift_JIS','ignore')) titlename = soup.find('title').string print titlename

[python] python爬網頁資料

工具: requests: http://docs.python-requests.org/en/latest/ 送出http請求 BeautifulSoup: http://www.crummy.com/software/BeautifulSoup/bs4/doc/ 分析抓回來的html原始碼 範例: import requests from BeautifulSoup import BeautifulSoup url = "http://ocg.xpg.jp/search/search.fcgi?CardNo=1&Record=1" res = requests.get(url, verify=False) soup = BeautifulSoup(''.join(res)) titlename = soup.find('title').string table1 = soup.find(class_="Hover w9") for row in table1.findAll('tr'): col = table1.findAll('td') day = col[0].string cheap = col[2].string top = col[3].string print titlename

[python] python連結mysql資料庫

模組:MySQLdb 官網:http://sourceforge.net/projects/mysql-python/ 安裝:pip install MySQL-python 用法: http://drizzlewalk.blog.51cto.com/2203401/448874 範例: db = MySQLdb.connect(host="localhost", user="root", passwd="12345678", db="yugioh") db.set_character_set('utf8') cursor = db.cursor() sqlcommand = "INSERT INTO `yugioh`.`yugioh` (`number`, `name`, `day`, `cheap`, `top`) VALUES ('aa', 'bb', 'cc', 'dd', 'ee')" cursor.execute(sqlcommand) db.commit()

2015年10月21日 星期三

2014年11月26日 星期三

[python] python快速筆記2

變數轉成字串

Number = job.get_last_buildnumber()
NumberString = str(Number)

字串寫入換行

f.write('abc')
f.write('\n')
f.write('123')

output file:

abc
123


字串相加

URLString = str(ww.yahoo.com)
URLString += '/mail'
print URLString

output:
www.yahoo.com/mail




2014年11月25日 星期二

[Jenkins] Slave Invoke Ant時出現錯誤

Slave server Invoke Ant時報錯:

FATAL: Cannot find executable from the chosen Ant installation "Ant 1.8"
Build step 'Invoke Ant' marked build as failure

原因:
slave上面沒有安裝ant


解決辦法:
從master上設定安裝ant到slave上

Jenkins -> Manage Jenkins -> Configure System -> Ant



[Appium] 開啟appium server時創建log出現錯誤

開啟:

appium -a 127.0.0.1 -p 4723 --no-reset --session-override -lt 180000 --command-timeout 180000 --log /Users/jenkins/workspace/Orange/label/Mac_Mini_2014_1/junit/appium.log

出現錯誤:

uncaughtException: ENOENT, open '/Users/jenkins/workspace/Orange/label/Mac_Mini_2014_1/junit/appium.log'


原因:node沒有該資料夾讀寫的權限

解決辦法:

1.開放該位置讀寫的權限
2. $sudo chmod -R 1777 /Users/jenkins/workspace/Orange/label/Mac_Mini_2014_1/junit/

2014年11月24日 星期一

[html] html圖片檔案位置

    網頁檔的位置
    圖檔的位置
    寫法
    說明
    c:\demo
    c:\demo<img src="ex.gif">圖文均在同一目錄
    c:\demo
    c:\demo\image<img src="image/ex.gif">圖在網頁下一層目錄
    c:\demo
    c:\<img src=" ../ex.gif">圖在網頁上一層
    c:\demo
    c:\image<img src=" ../image/ex.gif">圖文在同一層但不同目錄

[Python] Python in Mac 一些快速筆記

IDE: Sublime Text 2

執行  Terminal-> $pyhton /Users/Downloads/test1.py

開啟檔案

f = open('helloworld.html','w')

message = """<html>
<head></head>
<body><p>Hello World!</p></body>
</html>"""

f.write(message)
f.close()

執行web server

$python -m SimpleHTTPServer 8080


pip

https://bootstrap.pypa.io/get-pip.py

將此檔案(get-pip.py)另存新檔下來,再用python執行



python + jenkins

http://pythonhosted.org//jenkinsapi/

[Junit] Junit中的@Test沒有依照名字順序執行

一個junit架構下的class有多個@Test
可是執行的時候test case沒有依照test function名子照順序執行而是亂跳

解決:
在class上面加上一行   @FixMethodOrder(MethodSorters.NAME_ASCENDING)

test function就會依照名字順序執行了

[Appium] Appium的元件定位方法

Appium元件的定位方法


wd.findElement(By.xpath(“xpath‘)); ,其中By有許多方式可以達成


By.xpath 絕對路徑  (Android、iOS)

主要用於完全無法定位的元件最後手段


Ex.
wd.findElement(By.xpath("//UIAApplication[1]/UIAWindow[1]/UIAStaticText[11]"));


尋找方法:
使用Appium Inspector可以找到



By.name 名字  (iOS)
主要用於iOS RD寫app時有幫忙把元件標上名字時
Ex.
wd.findElement(By.name("topbar reload")).click();


尋找方法:
iOS在simulator中,Settings->Accessibility->Accessibility Inspector,
Appium Inspector也可以找到



By.id  resource ID  (Android)
主要用於Android RD有幫忙把元件標上名字時
Ex.
wd.findElement(By.id("com.myapp.test:id/url"));


尋找方法:
使用Android SDK中的hierarchy viewer,可使用含Android SDK的eclipse->DDMS->選擇Device->Dump hierarchy viewer


By.className 類別名稱  (Android、iOS)
用於從一個已知的節點,往下尋找沒有名子的特定類別的元件
尋找一個節點下面元件的方法:http://ffsonic.blogspot.tw/2014/11/appium.html


Ex.
Android:
wd.findElements(By.className("android.widget.TextView"));

iOS:
wd.findElement(By.className("UIASwitch")).click();



尋找方法:
Android - hierarchy viewer
iOS - Appium Inspector




ssss

2014年11月20日 星期四

[Appium] Appium server常用參數

Appium官方capabilities doc:

使用Terminal輸入 $appium 即可開啟appium server
開啟appium時可以添加參數使用,例如: $appium -a 127.0.0.1
輸入 $appium help  可觀看更多資訊


常用參數:


-a ip : 指定監聽的IP address
sample: -a 127.0.0.1


-p port : 指定監聽的port
sample: -p 4725


--no-reset: 每個session間不清除app資料。預設是false,每個session都會清除app data,加入此參數為 = true


-lt millisecond: 啟動app timeout秒數。session啟動app後,超過此時間app沒有launch會自動斷掉session,預設是60秒。
sample: -lt 180000


--command-timeout millisecond: 每個command之間的timeout秒數。超過此時間appium server沒有收到command會斷掉session。
sample: --command-timeout


--log directory: 輸出appium log到指定位置的檔案。
sample: --log /Users/Downloads/appium.log

--session-override: 強制覆寫session,預設為false。appium server一次只能接受一個session,當目前server正在執行一個session時有新的session進來,後來的session會被拒絕。使用此參數=true,當有新的session進來時會強制拋棄舊的seesion而使用新的session

2014年11月19日 星期三

[Mac] Mac執行檔案指令

執行.sh script

$cd /location/
$sh script

$cd /location/
$bash script

啟動執行檔

$cd /location/
$./script

sample:

cd /Downloads/adb/
./adb devices



[Appium] Appium跑iOS app的條件

大前提:台Mac的Xcode必須登入一個有iOS Development的帳號,不然連安裝app時都會失敗


1. 跑在simulator:
build app時必須額外加入simulator SDK

2.跑在device
必須有原始碼,開啟xcode -> Product -> Build For -> Testing
.app位置: /Users/Library/Developer/Xcode/DerivedData/workspace/Build/Products/Debug-iphones/

build app的電腦跟跑的電腦可以不一樣,只要apple id都有權限就可以