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(‘[email protected]’);
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 all
Open in new windowAdditionaly to that I could also format it with these options:
C# (WebDriver + MSTest)
C# (WebDriver + Nidnit)
Java (WebDriver + TestNG)
Java (WebDriver + Junit)
Java (WebDriver-backed Remote Control + Junit)
JSON (Dynatrace Synthetics)
Katalon Studio
Node (New Relic Synthetics)
Protractor (Typescript)
Python 2 (WebDriver * unittest)
Python (AppDynamics)
Robot Framework
Ruby (WebDriver + RSpec)
WebDriver io
Sample for new formatters
Puppeteer
Puppeteer w Comments
JSON (puppeteer)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.
Thanks!
Sascha
- The topic ‘Run a selenium script from within wordpress’ is closed to new replies.