Rayrun
โ† Back to Discord Forum

Page not using config baseURL

I'm attempting to use page.goto, assuming that baseURL set in my config file will be used, but it's not. The baseURL is set correctly

image.png

This thread is trying to answer question "Why is the baseURL set in the config file not being used when using page.goto?"

18 replies

I guess something is not set correctly but hard to suggest anything based on this screenshot.

I'm trying to make it so the browser chooses between web browser and CDP

image.png

It works with CDP, but with the regular browser, it's not ๐Ÿ˜ฆ

with cdp you're taking base url from some json file

unless I minunderstand something

Yeah, CDP works fine with that. I'm doing something similar with the context for the regular browser (but just changed it to localhost for brevity)

usually you need to set base url in playwright config to make it work with page.goto() https://playwright.dev/docs/test-use-options#basic-options

Yes, I do have that!

image.png

hm, actually you're overriding page fixture and in there you create a context with base url

try changing that to http://localhost:3000

because you're overriding page and context fixtures, I think the base url you set in the config file is ignored

sorry, hard to grasp things from bits and pieces

Sorry I tried to make it easier by simplifying the second screenshot with 'localhost:3000'. A actually always want the baseURL to be process.env.TEST_ENV ? env.find(e => e.env === process.env.TEST_ENV)?.baseURL : env.find(e => e.default)?.baseURL

If it's easier too and you're available, I can jump onto a call! @skorp32

can't do calls on corporate laptop unfortunately

as far as code goes, I'm out of ideas at the moment; last screenshot makes sense but I don't know why it wouldn't work

Ah okay thank you anyways, I appreciate it! I'm not too sure why either

Related Discord Threads

TwitterGitHubLinkedIn
AboutQuestionsDiscord ForumBrowser ExtensionTagsQA Jobs

Rayrun is a community for QA engineers. I am constantly looking for new ways to add value to people learning Playwright and other browser automation frameworks. If you have feedback, email luc@ray.run.