iThink
iThink copied to clipboard
react native vs Appium
Appium暂时不支持tag的方式
先通过accessibilityLabel来定位app中的元素
import React, {Component} from react
import {View, Text} from 'react-native'
export default class HelloApp extends Component {
render() {
return (
<View
accessible={true}
accessibilityLabel={"helloapp:text-label"}>
<Text>hello world</Text>
</View>
)
}
}
test code
def test_find_elements(self):
sleep(5)
user_input = self.driver.find_element_by_accessibility_id("helloapp:text-label")
为了测试的方便,android版本继承Stetho