Run a selenium script from within wordpress

Hi!

I want to run a selenium script from within the wordpress environment. How can I format the script so I can trigger it simply by linking to the scripts URL?

Here is the example of how I can pre-format the selenium script:

import { browser, by, element, Key, logging, ExpectedConditions as EC } from 'protractor';

describe('Second', () => {

   beforeAll(async () => { });
   beforeEach(async () => { });

   it('should do something', async () => {
      await browser.get('https://spehzies.de/wp-admin/edit.php?post_type=page');
      await element(by.xpath("//li[@id='toplevel_page_migrateguru']/a/div[3]")).click();
      await element(by.id("email")).click();
      await element(by.id("email")).sendKeys('s.koeth@haywood.de');
      await element(by.xpath("//div[@id='wpbody-content']/div[4]/div[2]")).click();
      await element(by.name("consent")).click();
      await element(by.id("migratesubmit")).click();
      await element(by.xpath("//div[@id='app']/span/div/div/div[2]/form/div/div/div/div[14]/span[2]")).click();
   });

   afterEach(async () => {
      // Assert that there are no errors emitted from the browser
      const logs = await browser.manage().logs().get(logging.Type.BROWSER);
      expect(logs).not.toContain(jasmine.objectContaining({
         level: logging.Level.SEVERE,
      } as logging.Entry));
   });

});


Select allOpen in new window

Additionaly to that I could also format it with these options:

Screenshot_1

So to make the objective more clear: I do not want to do testings by using any of those testing platforms. I simply want to run the script once the URL is called, without having to have any kind of platform accounts.

Can anyone give me a hint on what to try out?

Thanks!

Sascha

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.