DevExpress / testcafe

A Node.js tool to automate end-to-end web testing.
https://testcafe.io
MIT License
9.82k stars 672 forks source link

Scrapinghub / Crawlera Proxy Not Working with TestCafe? #3849

Closed doverradio closed 5 years ago

doverradio commented 5 years ago

What is your Test Scenario?

I am trying to use TestCafe with proxies, specifically proxies coming from the service scrapinghub.com and their product 'crawlera'. It's supposed to produce a brand new proxy ip from a pool of over 1 million ips. Sounds great up until I tried using this with TestCafe and every page never loads. I don't understand what I'm doing wrong so I need guidance please.

What is the Current behavior?

After using crawlera's proxy settings, the pages never load.

What is the Expected behavior?

Need pages to load.

What is your web application and your TestCafe test code?

Check this, easy simple script:

// google_tc.js
import { Selector } from 'testcafe';

fixture `example`
    .page `https://www.google.com/`;

test('Load Google.com', async t => {
    await t
        .typeText('input[name="q"]', 'home furniture')
        .wait(5000)
        .pressKey('enter');

}); 

Now, when I issue the command, I use this command:

testcafe google_tc.js --proxy <api-key-of-crawlera>:@proxy.crawlera.com:8010

So, while I cannot give publicly my API key, please see the syntax of my command. Is it right? I am using .testcaferc.json in same directory to cover other settings such as browser to use.

LavrovArtem commented 5 years ago

I think you type the unnecessary colon(:) symbol after <api-key-of-crawlera> if you don't want to pass a password.

doverradio commented 5 years ago

After hearing from scrapinghub.com's support, they advised me to leave out the '/' at the end of my command. Previously I put the command in my initial post but after I checked my actual script, my command was this:

testcafe google_tc.js --proxy <api-key-of-crawlera>:@proxy.crawlera.com:8010/

So, my mistake. The script of TestCafe will in fact work with crawlera proxies as long as the command you issue is like this:

testcafe google_tc.js --proxy <api-key-of-crawlera>:@proxy.crawlera.com:8010

Hopefully this helps others!

lock[bot] commented 5 years ago

This thread has been automatically locked since it is closed and there has not been any recent activity. Please open a new issue for related bugs or feature requests. We recommend you ask TestCafe API, usage and configuration inquiries on StackOverflow.