Skip to content

JSON Wire Protocol Library (WebDriver/Selenium WebDriver) for ObjFW

License

Notifications You must be signed in to change notification settings

GunGraveKoga/ObjWebDriver

Repository files navigation

ObjWebDriver

Reimplemented version of Selenium.framework for compatibility with ObjFW.

Features

Usage

RemoteWebDriver (aka SeleniumServer)

#import <ObjFW/ObjFW.h>
#import <Selenium/Selenium.h>

@interface AppDelegate: OFObject<OFApplicationDelegate>
@end

OF_APPLICATION_DELEGATE(AppDelegate)

@implementation AppDelegate

- (void)applicationDidFinishLaunching
{
	SECapabilities *c = [SECapabilities new];
 	c.browserName = @"firefox";

 	SERemoteWebDriver *driver = [[SERemoteWebDriver alloc] initWithServerAddress:@"localhost" port:4444 desiredCapabilities:c requiredCapabilities:nil error:NULL];

 	driver.url = [OFURL URLWithString:@"https://google.com"];

 	[driver quit];

 	[OFApplication terminate];
}
@end

GeckoDriver (FireFox browser)

#import <ObjFW/ObjFW.h>
#import <Selenium/Selenium.h>

@interface AppDelegate: OFObject<OFApplicationDelegate>
@end

OF_APPLICATION_DELEGATE(AppDelegate)

@implementation AppDelegate

- (void)applicationDidFinishLaunching
{
	SERemoteWebDriver *driver = [[SEGeckoDriver alloc] initWithExecutable:@"/usr/local/bin/geckodriver"];

 	SECapabilities *c = [SECapabilities new];

  	[driver startSessionWithDesiredCapabilities:c requiredCapabilities:nil];

  	driver.url = [OFURL URLWithString:@"https://google.com"];

  	[driver quit];

  	[OFApplication terminate];
}
@end

GeckoDriver (already executed webdriver server usage)

#import <ObjFW/ObjFW.h>
#import <Selenium/Selenium.h>

@interface AppDelegate: OFObject<OFApplicationDelegate>
@end

OF_APPLICATION_DELEGATE(AppDelegate)

@implementation AppDelegate

- (void)applicationDidFinishLaunching
{
	SERemoteWebDriver *driver = [[SEGeckoDriver alloc] initWithServerAddress:@"localhost" port:4444];

 	SECapabilities *c = [SECapabilities new];

  	[driver startSessionWithDesiredCapabilities:c requiredCapabilities:nil];

  	driver.url = [OFURL URLWithString:@"https://google.com"];

  	[driver quit];

  	[OFApplication terminate];
}
@end
OR
#import <ObjFW/ObjFW.h>
#import <Selenium/Selenium.h>

@interface AppDelegate: OFObject<OFApplicationDelegate>
@end

OF_APPLICATION_DELEGATE(AppDelegate)

@implementation AppDelegate

- (void)applicationDidFinishLaunching
{
	SECapabilities *c = [SECapabilities new];

 	SERemoteWebDriver *driver = [[SEGeckoDriver alloc] initWithServerAddress:@"localhost" port:4444 desiredCapabilities:c requiredCapabilities:nil error:NULL];

 	driver.url = [OFURL URLWithString:@"https://google.com"];

 	[driver quit];

 	[OFApplication terminate];
}
@end

For more information and examples look at Appium.app or source.

Requirements

  • Clang 3.8+
  • ObjFW v0.9-dev+

How to build

objfw-compile --arc -I/path/to/repo -I/path/to/repo/Selenium main.m /path/to/repo/.m /path/to/repo/Selenium/.m -o myapp

About

JSON Wire Protocol Library (WebDriver/Selenium WebDriver) for ObjFW

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published