question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Prescript does not work properly under hash route

See original GitHub issue

Hello,

I use preScript to complete the login operation, But if the test target switches routes through hash change and login page and test page are in the same domain, the system cannot jump to the test page after running Prescript.

The selenium script is working properly under Sitespeed 6.3.5.

Version: Sitespeed 7.2.0

Docker:

docker run --privileged --shm-size=1g --rm -v "$(pwd)":/sitespeed.io -p 5766:5900 -v /etc/localtime:/etc/localtime:ro sitespeedio/sitespeed.io:7.2.0 'http://xxxxxx' --video --speedIndex --browsertime.preScript ./selenium/tt_login.js --browsertime.chrome.args no-sandbox --browsertime.pageLoadStrategy normal --browsertime.block --plugins.load analysisstorer --browsertime.viewPort "1360x768" -n 1 -b chrome

Selenium script:

module.exports = {
    run(context) {
        return context.runWithDriver(async function(driver){
            const webdriver = context.webdriver;
            const until = webdriver.until;
            const By = webdriver.By;

            // config
            const url = 'http://xxxxxxx';
            const userXpath = '//*[@id="UserName"]';
            const passwordXpath = '//*[@id="Password"]';
            const userName = 'xxxxx';
            const password = 'xxxxx';
            const clickXpath = '//*[@id="Submit"]';

            // run
            async function doLogin(url, userXpath, passwordXpath, clickXpath, userName, password) {
                await driver.get(url);
                await driver.wait(until.elementLocated(By.xpath(userXpath)));
		await driver.wait(until.elementLocated(By.xpath(passwordXpath)));
		await driver.wait(until.elementLocated(By.xpath(clickXpath)));
		await driver.sleep(2000);
                await driver.findElement(By.xpath(userXpath)).sendKeys(userName);
                await driver.findElement(By.xpath(passwordXpath)).sendKeys(password);
                await driver.findElement(By.xpath(clickXpath)).click();
                await driver.sleep(5000);
            }
            await doLogin(url, userXpath, passwordXpath, clickXpath, userName, password)
                .then(_ => console.log('SUCCESS!'), e => console.error('FAILURE: ' + e));
        });
    }
};

Sorry for my bad English.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:31 (19 by maintainers)

github_iconTop GitHub Comments

1reaction
soulgalorecommented, Oct 15, 2018

Great @Nuoky I’be just released the changes in 7.6.0, hope it works for real this time.

1reaction
soulgalorecommented, Oct 12, 2018

@Nuoky Ok, I think I got a fix now. I’ve changed how we handle how we record the video and changed how we create the HAR from Chrome. I’ve pushed it to a branch in Browsertime, any chance you can try that with your real page so we know that it works before I move the code forward to a new release?

You can test it like this: docker run --shm-size=1g --rm -v "$(pwd)":/browsertime sitespeedio/browsertime-autobuild:better-orange 'https://dvajs.github.io/dva-hackernews/#/show' --preScript ./hackernews.js -n 1 -b chrome --pageCompleteCheckInactivity

I’ve changed when to end the test since there’s no onload event fired in the page when we do the next step. We can do some tuning here to make the “end” better, I need to look more into the code.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Backbone route doesn't works without hashes - Stack Overflow
My backbone routes works well when I grunt serve my app, but when I upload it, routes are all messed up. The homepage...
Read more >
Routing confusion - Solved - Working Examples Included
I'm trying to restore the “Save Gist” button to TryPurescript, and I believe incorporating routing is a prerequisite for that. The github OAuth...
Read more >
Hash v. Sofinowski :: 1985 - Justia US Law
Bodman, supra, our supreme court reiterated that an easement by prescription is limited to the adverse use made during the prescriptive period, but...
Read more >
Possession Of Hash Oil / Possession Of Hashish - kmwlegal
In Florida, it is not considered the same as Possession of Marijuana Less than 20 ... Yes, it is possible to get a...
Read more >
2020 National Drug Threat Assessment (NDTA) - DEA.gov
pills in the United States is likely due to Mexican. TCOs seeking to further distribute fentanyl into prescription opioid user populations as there...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found