如何切换到此框架

时间:2019-07-23 20:46:22

标签: python selenium-webdriver

我正在尝试获取框架,但始终在下面出现此错误:

getAll()

我的代码:

const msql = require("mysql2/promise");

// userService.getAll()
async function getAll() {
    var users;
    var query = "SELECT * FROM `users`"; // query database to get all the players
    let result = await connection.query(query);
    return result.map(u => {
        const {
            password,
            ...userWithoutPassword
        } = u;
        return userWithoutPassword;
    });
}

// request handler
function getAll(req, res, next) {
    userService.getAll().then(users => {
        console.log(users);
        res.json(users);
    }).catch(err => {
        console.log(error.message);
        res.redirect('error.ejs');
    });
})

我正在尝试获取this frame

1 个答案:

答案 0 :(得分:0)

找到添加一些代码行的解决方案。 看:

import time, re
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support.ui import Select

browser = webdriver.Firefox()
browser.get("http://ndspx13/")
browser.maximize_window()

#browser.implicitly_wait(3);

browser.switch_to.parent_frame()
browser.switch_to.frame(0)
browser.find_element_by_link_text("Servidor x IP").click()