Skip to content

evalJavascript() won't work HTML DOM Methods #304

@rma6

Description

@rma6

I'm trying to a input with text and submit a form.
When I press a button the following function is called

Future<void> _handleCNPJ() async {
    FlutterWebviewPlugin webView = new FlutterWebviewPlugin();

    await webView.launch(
      'http://www.receita.fazenda.gov.br/PessoaJuridica/CNPJ/cnpjreva/Cnpjreva_Solicitacao.asp',
      rect: new Rect.fromLTWH(0.0, 0.0, MediaQuery.of(context).size.width,
          MediaQuery.of(context).size.height / 2),
      userAgent: 'Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, 
          like Gecko) Chrome/62.0.3202.94 Mobile Safari/537.36',
      scrollBar: false,
      withZoom: false,
      supportMultipleWindows: false,
    );
    
    await webView.evalJavascript("document.getElementById('cnpj').value = 'testing'");
    await webView.close();
  }

But nothing happens on the WebView.
What am I doing wrong?

Thanks in advance.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions