Lucifer
Lucifer

Reputation: 626

Module not found: Error: Can't resolve 'http' in selenium-webdriver

I found this error :

ERROR in ./node_modules/selenium-webdriver/http/index.js Module not found: Error: Can't resolve 'https' in '/Users/mac/angular/restaurantApp/node_modules/selenium-webdriver/http'

Can any one help me to solve that.

Thanks

Upvotes: 10

Views: 15288

Answers (7)

Manishag
Manishag

Reputation: 11

My mistake was that I imported the HttpClient from selenium-webdriver/http:

import { HttpClient } from 'selenium-webdriver/http';

Replace this line with:

import { HttpClient } from '@angular/common/http';

Upvotes: 1

PrashantSharma
PrashantSharma

Reputation: 11

My problem had been resolved by replacing

=>    import { HttpClient } from 'selenium-webdriver/http';
to => import { HttpClient } from '@angular/common/http';

from my one ts file in angular 7

Upvotes: 1

Arshad Syed
Arshad Syed

Reputation: 403

I had same issue when I was working with Angular and Laravel where I wanted to add HTTP module in app.module.ts and also in my.component.ts but it added to the selenium HTTP client.

So I changed from

import { HttpClient } from 'selenium-webdriver/http';

To

import { HttpClientModule} from '@angular/common/http';

Upvotes: 3

Siddharth Pandey
Siddharth Pandey

Reputation: 1

it means to change import { HttpClient } from 'selenium-webdriver/http'; to import { HttpClient } from '@angular/common/http';

Upvotes: 0

Thiago Pires
Thiago Pires

Reputation: 158

resolved change auto import do httpclient at import { HttpClient, HttpHeaders } from '@angular/common/http';

Upvotes: 0

Prusio
Prusio

Reputation: 425

I have had a similar problem with error code:

ERROR in ./src/app/my.service.ts   
Module not found: Error: Can't resolve '../../node_modules/@types/selenium-webdriver/http' in '...\src\app

Problem was with Visual Studio Code's Autoimport plugin importing HttpClient class from

'../../node_modules/@types/selenium-webdriver/http'

instead of

'../../node_modules/@angular/common/http'

I found this question somehow helpful, but it did not give me a clear answer. I post what I found out so that another visitor will have it easier.

Upvotes: 27

 Rafal612
Rafal612

Reputation: 23

For other visitors. I added import { HttpClient } from 'selenium-webdriver/http'; instead of import { HttpClient } from '../../../node_modules/@types/selenium-webdriver/http'; in custom servsiv

Upvotes: 1

Related Questions