当我单击以下按钮时,我希望被重定向到href. 但是它不起作用:
<button href="/auth"> Google+ </button>
Run Code Online (Sandbox Code Playgroud)
我不确定这是否重要,但我正在运行一个节点应用程序。
如何通过单击按钮导航到路线?
以下行的错误:
await page.waitForFunction('document.querySelector(".eo-validation-code").inner??Text.length == 32');
这是在上下文中:
const puppeteer = require('puppeteer');
puppeteer.launch({ignoreHTTPSErrors: true, headless: false}).then(async browser => {
const page = await browser.newPage();
console.log(2);
await page.setViewport({ width: 500, height: 400 });
console.log(3)
const res = await page.goto('https://apps.realmail.dk/scratchcards/eovendo/gui/index.php?UserId=60sEBfXq6wNExN4%2bn9YSBw%3d%3d&ServiceId=f147263e75262ecc82d695e795a32f4d');
console.log(4)
await page.waitForFunction('document.querySelector(".eo-validation-code").inner??Text.length == 32').catch(err => console.log(err));
Run Code Online (Sandbox Code Playgroud)
它基本上是这个答案的复制粘贴:https : //stackoverflow.com/a/46825433/10238810 除了我更改了 querySelector 以查找类名为“eo-validation-code”的元素。
我尝试了以下操作,但不起作用:
console.log(process.env.BASE_URL); #output: undefined
Run Code Online (Sandbox Code Playgroud)
假设我的heroku应用的主机名是:https : //RyanCameron-app.herokuapp.com
我应该如何在heroku上获取该base_url?
我正在寻找一种解决方案,以避免分别取消注释/注释以下行:
const url = 'https://RyanCameron-app.herokuapp.com/projects/eovendo' //production
//const url = 'http://localhost:3000' //development
Run Code Online (Sandbox Code Playgroud)
变得很烦..