Open tiagodread opened 1 year ago
The approach:
[0-0] 2023-05-19T19:09:05.527Z INFO webdriver: [POST] http://127.0.0.1:4723/session/f4d4905a-00ad-4268-bddb-e5fa3a934d85/element/eyJmaW5kZXJUeXBlIjoiQnlWYWx1ZUtleSIsImtleVZhbHVlU3RyaW5nIjoidW5sb2dnZWQtbmV3LWNsaWVudC1jcmVhdGUtYWNjb3VudC1idG4iLCJrZXlWYWx1ZVR5cGUiOiJTdHJpbmcifQ/click
[0-0] 2023-05-19T19:09:05.614Z INFO webdriver: RESULT {}
[0-0] 2023-05-19T19:09:05.614Z INFO webdriver: COMMAND elementClick("eyJmaW5kZXJUeXBlIjoiQnlWYWx1ZUtleSIsImtleVZhbHVlU3RyaW5nIjoiZnVsbC1uYW1lLWZpZWxkIiwia2V5VmFsdWVUeXBlIjoiU3RyaW5nIn0")
[0-0] 2023-05-19T19:09:05.615Z INFO webdriver: [POST] http://127.0.0.1:4723/session/f4d4905a-00ad-4268-bddb-e5fa3a934d85/element/eyJmaW5kZXJUeXBlIjoiQnlWYWx1ZUtleSIsImtleVZhbHVlU3RyaW5nIjoiZnVsbC1uYW1lLWZpZWxkIiwia2V5VmFsdWVUeXBlIjoiU3RyaW5nIn0/click
[0-0] 2023-05-19T19:09:09.049Z INFO webdriver: RESULT {}
[0-0] 2023-05-19T19:09:09.050Z INFO webdriver: COMMAND executeScript("flutter:enterText", <object>)
[0-0] 2023-05-19T19:09:09.051Z INFO webdriver: [POST] http://127.0.0.1:4723/session/f4d4905a-00ad-4268-bddb-e5fa3a934d85/execute/sync
[0-0] 2023-05-19T19:09:09.051Z INFO webdriver: DATA { script: 'flutter:enterText', args: [ 'Tiago Goes da Silva' ] }
[0-0] 2023-05-19T19:09:09.071Z INFO webdriver: RESULT {
[0-0] isError: false,
[0-0] response: {},
[0-0] type: '_extensionType',
[0-0] method: 'ext.flutter.driver'
[0-0] }
Also doesn't work on emulator, even looking like happened via logs...
Hello, thanks for maintaining this webdriver!
I noticed that
await driver.elementSendKeys(emailField, "example@example.com")
doesn't work in some cases, I've built a sample app to test the driver.I've tried:
Sample App code
```dart import 'package:flutter/material.dart'; import 'package:flutter_driver/driver_extension.dart'; void main() { enableFlutterDriverExtension(); runApp(const MyApp()); } class MyApp extends StatelessWidget { const MyApp({super.key}); @override Widget build(BuildContext context) { return MaterialApp( title: 'Test App', theme: ThemeData( primarySwatch: Colors.blue, ), home: const LoginPage(), ); } } class LoginPage extends StatefulWidget { const LoginPage({super.key}); @override _LoginPageState createState() => _LoginPageState(); } class _LoginPageState extends StateTest code
```ts import { byValueKey } from 'appium-flutter-finder' describe('My Login application', () => { it('should login with valid credentials', async () => { const emailField = byValueKey('login-email') const passField = byValueKey('login-password') const loginButton = byValueKey('login-access') const loginSuccessMessage = byValueKey('snack-bar-ok') await driver.elementSendKeys(emailField, 'example@example.com') await driver.elementSendKeys(passField, 'Mudar@123') await driver.elementClick(loginButton) expect(await driver.getElementText(loginSuccessMessage)).toBe('Login success') }) }) ```However, using a more complex app (I cannot share here the code since due to security), the command does nothing!
looking the logs it seems to sendKeys, but visually on the emulator nothing happened
Logs from server
Any suggestions other than switching the context all the time to NATIVE_APP to deal with inputs (EditText) via xpath??