my task is to generate a pdf screenshot of a certain page. We're using Laravel for the BE (running on http://127.0.0.1:8000) and Angular on the FE (running on http://localhost:4200).
While trying to run the code below
public function generatePdf(Request $request, $id)
{
$path = public_path("/uploads/");
if (!File::exists($path)) {
File::makeDirectory($path, 0755, true);
}
Browsershot::url('http://localhost:4200/#/dashboard')
->authenticate('[email protected]', 'Monday@123')
->select('.ng-star-inserted')
->setDelay(3000)
->save($path . 'example.pdf');
echo 'Pdf generated at <i>public/uploads/example.pdf</i>';
}
Browsershot generates the pdf screenshot of http://localhost:4200/#/login instead of http://localhost:4200/#/dashboard. I'm pretty sure I used the correct login credentials in authenticate().
