私はテストの自動化のためにappiumを使用しています。私はビットマップに現在のアプリの画面を格納するビューオブジェクトが必要です。appiumのリソースIDからビューオブジェクトを取得するにはどうすればよいですか?
public Bitmap takeScreenShot(View view) {
view.setDrawingCacheEnabled(true);
view.setDrawingCacheQuality(View.DRAWING_CACHE_QUALITY_LOW);
view.buildDrawingCache();
if(view.getDrawingCache() == null) return null;
Bitmap snapshot = Bitmap.createBitmap(view.getDrawingCache());
view.setDrawingCacheEnabled(false);
view.destroyDrawingCache();
return snapshot;
}
AppiumDriver driver = new AndroidDriver(new URL(""),capabilities);//capabilities and URL are set
WebElement el = driver.findElement(By.id("com.example.app:id/video_view"));
View view = ?? //get view object from el
takeScreenShot(view);
あなたは 'WebElement el'ため' android.view.View'を取得したいですか? – nullpointer
はい、それは私が欲しいものです – Gsquare
あなたの基本目的は何で、なぜ要素の 'View'型が必要ですか? – nullpointer