get access to table in the iframe

独自空忆成欢 提交于 2019-12-02 18:56:20

问题


i have a website , login: cyclefreight1@usa.com pas: 12345678, log in and go to the drivers section(left menu bar firs item > drivers) I want to make some additional function to this web with tampermonkey. All information about drivers consist in the table, and information about current driver is available when you click to "Go to the current log" button

i try to add some new functions to the current drivers section all this stuff are in the iframe , so i try to do an event listener to the button like this

// @name         drivers
// @match        https://eldclient.trackingmap.eu/drivers*
// @grant        none
// @require http://code.jquery.com/jquery-1.12.4.min.js
// ==/UserScript==

setTimeout(() => {

    var el = document.getElementsByClassName("fa fa-file-text");
    console.log(el);
    el[1].addEventListener("click",console.log("yeah")) ;

}, 5000);

but it didn`t work , after click i want to get all the elements from table in the current log section. In the drivers section it works for me

 **// @name         drivers
    // @match        https://eldclient.trackingmap.eu/drivers*
    // @grant        none
    // @require http://code.jquery.com/jquery-1.12.4.min.js
    // ==/UserScript==

    setTimeout(() => {
      const rows = document.querySelectorAll("#app table.table-component tr");
      console.log(rows);

    }, 5000);**

do you have any idea or tips , than you ^)

来源:https://stackoverflow.com/questions/50358264/get-access-to-table-in-the-iframe

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!