A fork of https://github.com/ueokande/vim-vixen
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
37 lines
1.1 KiB
37 lines
1.1 KiB
5 years ago
|
import { Lanthan } from 'lanthan';
|
||
|
import { WebDriver, By } from 'selenium-webdriver';
|
||
|
import JSONOptionPage from './JSONOptionPage';
|
||
|
import FormOptionPage from './FormOptionPage';
|
||
|
|
||
|
export default class OptionPage {
|
||
|
private webdriver: WebDriver;
|
||
|
|
||
|
constructor(private lanthan: Lanthan) {
|
||
|
this.webdriver = lanthan.getWebDriver();
|
||
|
}
|
||
|
|
||
|
static async open(lanthan: Lanthan) {
|
||
|
let url = await lanthan.getWebExtBrowser().runtime.getURL("build/settings.html")
|
||
|
await lanthan.getWebDriver().navigate().to(url);
|
||
|
return new OptionPage(lanthan);
|
||
|
}
|
||
|
|
||
|
async switchToForm(): Promise<FormOptionPage> {
|
||
|
let useFormInput = await this.webdriver.findElement(By.css('#setting-source-form'));
|
||
|
await useFormInput.click();
|
||
|
await this.webdriver.switchTo().alert().accept();
|
||
|
return new FormOptionPage(this.lanthan);
|
||
|
}
|
||
|
|
||
|
async asFormOptionPage(): Promise<FormOptionPage> {
|
||
|
// TODO validate current page
|
||
|
return new FormOptionPage(this.lanthan);
|
||
|
}
|
||
|
|
||
|
async asJSONOptionPage(): Promise<JSONOptionPage> {
|
||
|
// TODO validate current page
|
||
|
return new JSONOptionPage(this.lanthan);
|
||
|
}
|
||
|
}
|
||
|
|