How can I use Protractor with google.com?

google.com is not an Angular application, but Protractor can still test it, right? I am trying to perform a simple search test, but continue to work with errors.

specification:

browser.ignoreSynchronization = true; describe('Google Demo', function() { it('Should Search', function() { browser.get('http://google.com/'); browser.wait(element(By.id('q')).isPresent); element(By.id('q')).sendKeys('please work'); }); }); 

error:

 Failures: 1) Google Demo Should Search Message: TypeError: Cannot read property 'count' of undefined 

What am I doing wrong? I would be grateful for any help!

+6
source share
2 answers

Since this application is not Angular, you need to use browser.driver instead of browser . GitHub Link for Angular Application

 browser.ignoreSynchronization = true; describe('Google Demo', function() { it('Should Search', function() { browser.driver.get('http://google.com/'); browser.driver.findElement(by.name('q')).sendKeys('please work'); }); }); 

It works on my system!

+15
source

it also works for nonangular applications

 browser.waitForAngularEnabled(false); 

 describe('Google search', function() { it('should search a text as GURU99', function() { browser.waitForAngularEnabled(false); browser.get('https://www.google.com'); element(by.name("q")).sendKeys('test') browser.sleep(5000); }); }); 

0
source

Source: https://habr.com/ru/post/985634/


All Articles