0
  • I am running this selenium tests in locally and this works fine and find all XPaths fines,but if I try to run this code in GitHubActions the code gives an error saying it did not find the XPath for 'name'. Someone can help?

Code:

 [TestFixture]
    public class CETestsActionDev
    {
        private IWebDriver driver;

        private readonly string environment = "dev";

        private static int _randomNumber;

        [SetUp]
        public void Setup()
        {
            //They re commented because if not, code in gbActions doesnt find even "userName"
            //ChromeOptions options = new();
            //options.AddArgument("start-maximized");
            //options.AddArgument("--disable-gpu");
            //options.AddArgument("--headless");

            driver = new ChromeDriver();    
            driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(10);
        }
   [Test]
   public void SuccessCloudExpertProfile()
   {
    Thread.Sleep(TimeSpan.FromSeconds(5));
    driver.Navigate().GoToUrl("https:comapnyExemplo.com");
    Thread.Sleep(TimeSpan.FromSeconds(10));
    string emailDev = "[email protected]";

    driver.FindElement(By.XPath("//*[@id='userName']")).SendKeys(emailDev);
    driver.FindElement(By.XPath("//*[@id='password']")).SendKeys("testCloud2Gether");

    Thread.Sleep(TimeSpan.FromSeconds(1));

    driver.FindElement(By.XPath("//*[@id='buttonForm']")).Click();

    Thread.Sleep(TimeSpan.FromSeconds(10));

     AddPublicNameAndAboutField(driver);
   //First xpath from this method is "name"
 AddLanguages(driver);
 RemoveLanguages(driver);
 CorrectAdress(driver);
 }

GitHub Actions Yaml: Test_Project_Path: C2GSeleniumTeste.csproj

steps:

  • name: Checkout uses: actions/checkout@v4 with: fetch-depth: 0

  • name: Install .NET Core uses: actions/setup-dotnet@v4 with: dotnet-version: 8.0.x

  • name: Install Chrome uses: browser-actions/setup-chrome@v1 with: chrome-version: 'stable'

  • name: Restore dependencies run: dotnet restore ${{ env.Test_Project_Path }}

  • name: Run tests run: dotnet test ${{ env.Test_Project_Path }} --configuration Release --logger trx --results-directory .

  • name: Upload test results if: failure() uses: actions/upload-artifact@v3 with: name: test-results path: '*.trx' if-no-files-found: warn

I want to run selenium code in GithubActions but im not having success

1 Answer 1

1

When the tests were running in GitHub Actions, the reCAPTCHA was activated.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.