0

Is it possible from an Android App within Android Runtime to enter text in a texfield of a website and trigger a button click on that site programmatically? This little App has a Button, after clicking that Button chrome is opened with a website.

import android.content.Intent;
import android.net.Uri;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;

public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        Button mybutton = (Button) findViewById(R.id.button);

        mybutton.setOnClickListener(new View.OnClickListener() {

            @Override
            public void onClick(View v) {

                String url = "https://www.bahn.de/p/view/index.shtml";
                Intent i = new Intent(Intent.ACTION_VIEW);
                i.setData(Uri.parse(url));
                startActivity(i);
            }
        });
    }
}

This website has textfields to enter text. But how can they be accessed?

Running24
  • 100
  • 8
  • Have a look into this https://stackoverflow.com/a/9581016/3967525 – Soham Oct 30 '19 at 11:24
  • Thanks, will check that. – Running24 Oct 30 '19 at 16:21
  • Ah I see, you can read text from a website. But I still don't understand how to enter text to a textfield of a website programmatically :/ – Running24 Oct 30 '19 at 21:37
  • Are you trying to programmatically submit a form to a webserver? – Clyde Oct 30 '19 at 21:58
  • What I am trying: on button click the App shall open chrome, go to a website, say google.com, enter some text in the searchfield, and then trigger seach button click. I know in this case it is possible to just open the url = "https://www.google.com/search?q=sushi", but I am trying to do it programmatically. – Running24 Oct 31 '19 at 06:41

0 Answers0