有沒有可能在移動瀏覽器上上傳文件(iOS上的Safari,Android上的Chrome)?傳統方法似乎不起作用。也許有類似的選擇BrowserStack文件上傳實際上可以工作?Selenium File使用BrowserStack上傳iOS或Android
0
A
回答
0
這是使用Base64和JS哈克文件上傳解決方案,但它的工作原理,所以哎,我希望你找到這個有用:
public CorePage UploadHack(string fileInputId, string contentType, string fileContent, string fileName, string angularScopeVar)
{
UploadFile(_filePath);
var uploadHack =
"(function(){" +
"function convert(base64){" +
"var raw = atob(base64);" +
"var arr = new Uint8Array(new ArrayBuffer(raw.length));" +
"for (var i = 0; i < raw.length; i++){" +
"arr[i] = raw.charCodeAt(i);" +
"}" +
"return arr; " +
"}" +
$"var file = new Blob([convert('{fileContent}')], {{'type':'{contentType}'}}); " +
$"file.name = '{fileName}'; " +
$"angular.element('#{fileInputId}').scope().{angularScopeVar} = file;" +
"})()";
Driver.ExecuteJavaScript(uploadHack);
return this;
}
0
BrowserStack使用Appium在Android和iOS上驅動您的Selenium測試。
由於here,由於Appium目前不支持上傳,BrowserStack也無法支持移動設備上的文件上傳。
+0
謝謝你,至少它現在是明確的,但不是很好的消息 –
相關問題
- 1. 上傳功能(BrowserStack使用node.js)
- 2. 如何使用Ruby中的Selenium WebDriver上傳文件(type =「file」)
- 3. Browserstack&Selenium - 代理配置
- 4. Android(或iOS) - 圖像上傳隊列
- 5. 「angular-file-upload.js」文件使用'node.js'上傳
- 6. 如何使用Junit Selenium上傳文件?
- 7. 在C#中使用Selenium上傳文件?
- 8. Onclick FILE上傳DOM PHP jquery
- 9. 如何在BrowserStack上針對iOS和android運行實驗室測試?
- 10. 使用Selenium IDE進行文件上傳(不是Selenium WD/RC)
- 11. 用socketio-file-upload上傳圖片
- 12. Selenium上傳圖片
- 13. Cordova Android:使用官方cordova-plugin-file-transfer上傳文件時的空請求
- 14. 在iOS模擬器上使用selenium啓用/禁用Wifi/Appium
- 15. Selenium webdriver在Mac或Linux上上傳文件窗口
- 16. selenium:使用python上傳使用send_keys的大文件
- 17. 量角器E2E TEST多文件上傳使用ng-file-upload
- 18. 在IE9上傳文件失敗使用ng-file-upload + Spring MVC + OAuth2.0
- 19. 如何在上傳前使用ng-file-upload預覽圖像
- 20. 使用socketio-file-upload上傳多個文件
- 21. 當沒有使用angular-file-upload指令上傳文件時?
- 22. LK在iOS或Android上使用OpenGL ES的光流
- 23. 在ios上使用cordova-file-transfer插件進行多部分表格數據圖片上傳失敗
- 24. 在Ubuntu上使用Python Selenium上傳文件
- 25. Selenium RC上傳文件
- 26. selenium webdriver上傳文件
- 27. 用於IOS或Android的Python
- 28. 直接使用Selenium RC或機器人框架使用Selenium
- 29. 使用Dropbox上傳照片iOS SDK
UploadFile這裏基本上是UploadElement.SendKeys(「文件路徑」):)有時候取決於你的情況可能完全沒有必要 –