I am using Visual Studio 2017 and found that class ChromeDriver does not contains method getPageSource(). Does anybody knows why?

using System;
using System.IO;
using OpenQA.Selenium.Chrome;
using OpenQA.Selenium;
using OpenQA.Selenium.Support.UI;

Error CS1061 "ChromeDriver" no contiene una definición para "getPageSource" ni se encuentra ningún método de extensión "getPageSource" accesible que acepte un primer argumento del tipo "ChromeDriver" (¿falta alguna directiva using o una referencia de ensamblado?) SeleniumTest C:\tfs\CHI-VT-DEV\04-Programación\VisualTIME\Test\Functional\SeleniumTest\InMotionGIT.Test.Selenium.cs 29 Activo

  • Please edit your question to add the code where you are calling getPageSource
    – Kate Paulk
    Jan 25 '19 at 19:27
  • Additionally, could you update the error message to English? Jan 25 '19 at 20:11

In C# (VS) you should to use:

string html = this.driver.PageSource;

instead of


The getPageSource method, in C#, is actually a property:

string html = this.driver.PageSource;

See PageSource documentation for more information.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.