gpt-driver-node 1.0.0-alpha.8 → 1.0.0-alpha.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -1,7 +1,6 @@
1
1
  'use strict';
2
2
 
3
3
  var axios = require('axios');
4
- var seleniumWebdriver = require('selenium-webdriver');
5
4
  var sharp = require('sharp');
6
5
 
7
6
  const delay = async (milliseconds) => {
@@ -83,18 +82,20 @@ class GptDriver {
83
82
  let platformVersion;
84
83
  let deviceName;
85
84
  let sessionId;
86
- if (this.driver instanceof seleniumWebdriver.WebDriver) {
87
- const capabilities = await this.driver.getCapabilities();
85
+ if (this.driver.sessionId == null) {
86
+ const driver = this.driver;
87
+ const capabilities = await driver.getCapabilities();
88
88
  platform = capabilities.get("platformName");
89
89
  platformVersion = capabilities.get("platformVersion") ?? this.appiumSessionConfig?.platformVersion;
90
90
  deviceName = this.appiumSessionConfig?.deviceName ?? capabilities.get("deviceName");
91
- const session = await this.driver.getSession();
91
+ const session = await driver.getSession();
92
92
  sessionId = session.getId();
93
93
  } else {
94
- platform = this.driver.capabilities["appium:platformName"];
95
- platformVersion = this.driver.capabilities["appium:platformVersion"];
96
- deviceName = this.appiumSessionConfig?.deviceName ?? this.driver.capabilities["appium:deviceName"] ?? "";
97
- sessionId = this.driver.sessionId;
94
+ const driver = this.driver;
95
+ platform = driver.capabilities["appium:platformName"];
96
+ platformVersion = driver.capabilities["appium:platformVersion"];
97
+ deviceName = this.appiumSessionConfig?.deviceName ?? driver.capabilities["appium:deviceName"] ?? "";
98
+ sessionId = driver.sessionId;
98
99
  }
99
100
  this.appiumSessionConfig = {
100
101
  ...this.appiumSessionConfig,
package/dist/index.mjs CHANGED
@@ -1,5 +1,4 @@
1
1
  import axios from 'axios';
2
- import { WebDriver } from 'selenium-webdriver';
3
2
  import sharp from 'sharp';
4
3
 
5
4
  const delay = async (milliseconds) => {
@@ -81,18 +80,20 @@ class GptDriver {
81
80
  let platformVersion;
82
81
  let deviceName;
83
82
  let sessionId;
84
- if (this.driver instanceof WebDriver) {
85
- const capabilities = await this.driver.getCapabilities();
83
+ if (this.driver.sessionId == null) {
84
+ const driver = this.driver;
85
+ const capabilities = await driver.getCapabilities();
86
86
  platform = capabilities.get("platformName");
87
87
  platformVersion = capabilities.get("platformVersion") ?? this.appiumSessionConfig?.platformVersion;
88
88
  deviceName = this.appiumSessionConfig?.deviceName ?? capabilities.get("deviceName");
89
- const session = await this.driver.getSession();
89
+ const session = await driver.getSession();
90
90
  sessionId = session.getId();
91
91
  } else {
92
- platform = this.driver.capabilities["appium:platformName"];
93
- platformVersion = this.driver.capabilities["appium:platformVersion"];
94
- deviceName = this.appiumSessionConfig?.deviceName ?? this.driver.capabilities["appium:deviceName"] ?? "";
95
- sessionId = this.driver.sessionId;
92
+ const driver = this.driver;
93
+ platform = driver.capabilities["appium:platformName"];
94
+ platformVersion = driver.capabilities["appium:platformVersion"];
95
+ deviceName = this.appiumSessionConfig?.deviceName ?? driver.capabilities["appium:deviceName"] ?? "";
96
+ sessionId = driver.sessionId;
96
97
  }
97
98
  this.appiumSessionConfig = {
98
99
  ...this.appiumSessionConfig,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gpt-driver-node",
3
- "version": "1.0.0-alpha.8",
3
+ "version": "1.0.0-alpha.9",
4
4
  "main": "./dist/index.cjs",
5
5
  "module": "./dist/index.mjs",
6
6
  "types": "./dist/index.d.cts",