simulate keyboard input / insert string into textarea (adwords)

后端 未结 2 458
盖世英雄少女心
盖世英雄少女心 2021-02-04 21:09

I am trying to scrape keywords from https://adwords.google.com/ko/KeywordPlanner/Home using CefSharp (version 43)

I am able to log into the adwords portal p

相关标签:
2条回答
  • 2021-02-04 21:50

    code by @masroore worked well and saved me today. But then I found this method is deprecated and is in the process of being dropped.

    Updated the code with new method which does the same thing:

    function setKeywordText(text) 
    {
        var el = document.getElementById("gwt-debug-keywords-text-area");
        el.value = text;
        var evt= new Event('change');
        el.dispatchEvent(evt);
    }
    
    0 讨论(0)
  • 2021-02-04 21:54

    Ok, I found the solution:

    function setKeywordText(text) {
        var el = document.getElementById("gwt-debug-keywords-text-area");
        el.value = text;
        var evt = document.createEvent("Events");
        evt.initEvent("change", true, true);
        el.dispatchEvent(evt);
    }
    
    setKeywordText("test");
    
    0 讨论(0)
提交回复
热议问题