Git Product home page Git Product logo

webdriverxx's Introduction

Webdriver++

A C++ client library for Selenium Webdriver. You can use this library in any C++ project.

Only 4.x and more Selenium Server.

COPYRIGHTS

SPECIAL THANKS

Cloning repository

git clone --recurse-submodules https://github.com/GermanAizek/webdriverxx.git
cd webdriverxx

Compilation requirements

Debian

sudo apt-get install cmake g++ make curl

Ubuntu and Ubuntu Touch

sudo apt-get install cmake g++ make curl libcurl4-openssl-dev

Arch Linux

sudo pacman -Syu cmake g++ make curl

Gentoo

sudo emerge -av dev-util/cmake sys-devel/gcc sys-devel/make net-misc/curl

Compile on Linux, FreeBSD, OpenBSD

mkdir build && cd build && cmake ../src
sudo make

Compile on Windows

mkdir build
cd build
cmake ../src
# For example, open a solution in Visual Studio

Install GeckoDriver or ChromeDriver on Linux

GeckoDriver

To work with GeckoDriver, you need any browser built on the Gecko engine.

Firefox (ESR, Nightly), IceCat, Waterfox, Pale Moon, SeaMonkey and etc.

In our examples, we will install official stable Firefox.

Debian, Ubuntu, Ubuntu Touch

sudo apt-get install geckodriver

Arch Linux

sudo pacman -Syu geckodriver

Gentoo

USE="geckodriver" sudo emerge -av www-client/firefox

ChromeDriver

To work with chromedriver, you need any browser built on the Chromium engine.

Chromium, Google Chrome, Opera, Vivaldi and etc.

In our examples, we will install official stable Google Chrome.

Debian, Ubuntu, Ubuntu Touch

sudo apt-get install chromium-driver

Arch Linux

sudo yay -S --aur aur/chromedriver

Gentoo

sudo emerge -av www-client/chromedriver-bin

A quick example

Dependencies

The first thing you need is full runtime environment Java.

You need to download and run selenium-server-standalone.

Windows

Download latest OpenJDK and unpack: https://openjdk.java.net/

Official Selenium server can be seen here: https://selenium-release.storage.googleapis.com/index.html

Set the path enviroment variable to OpenJDK or move to the OpenJDK folder

java -jar /path_to/selenium-server-4.0.0-beta-4.jar standalone

Linux

Download latest OpenJDK from packet manager distributions Linux.

Debian, Ubuntu, Ubuntu Touch
sudo apt-get install default-jre
Arch Linux
sudo pacman -Syu jre-openjdk jre-openjdk-headless
Gentoo
sudo emerge -av virtual/jre

Official Selenium server can be seen here: https://selenium-release.storage.googleapis.com/index.html

wget https://selenium-release.storage.googleapis.com/4.0-beta-4/selenium-server-4.0.0-beta-4.jar

or download from AUR here:

sudo yay -S --aur aur/selenium-server-standalone

After now you can start.

Any Linux distribution
java -jar selenium-server-4.0.0-beta-4.jar standalone

If Selenium server standalone was downloaded from AUR (Arch Linux), then:

java -jar /usr/share/selenium-server/selenium-server-standalone.jar

Run Google Test for testing html pages

On Windows:

cd src/vcprojects/
# Open a solution 'webdriverxx.sln' in Visual Studio and compile it

More info in MSDN: Build and run a C++ app project

Examples

Build CMakeLists in 'examples' folder and run binary.

On Linux:

cd examples/example_start_browsers
mkdir build && cd build
cmake ..
make
./example_start_browsers

Features

  • Very lightweight framework (When compared with all implementations of api selenium)
  • Chainable commands
  • Value-like objects compatible with STL containers
  • Header-only
  • Lightweight dependencies:
  • Can be used with any testing framework
  • Linux, FreeBSD, OpenBSD, Mac and Windows
  • Tested on GCC 9.x, Clang 10.x and MSVC Visual Studio 2019

More examples

All examples are in 'examples' folder.

Use proxy

WebDriver ie = Start(InternetExplorer().SetProxy(
	SocksProxy("127.0.0.1:3128")
		.SetUsername("user")
		.SetPassword("12345")
		.SetNoProxyFor("custom.host")
	));
WebDriver ff = Start(Firefox().SetProxy(DirectConnection()));

Navigate browser

driver
	.Navigate("http://facebook.com")
	.Navigate("http://twitter.com")
	.Back()
	.Forward()
	.Refresh();

Find elements

// Throws exception if no match is found in the document
Element menu = driver.FindElement(ById("menu"));

// Returns empty vector if no such elements
// The search is performed inside the menu element
std::vector<Element> items = menu.FindElements(ByClass("item"));

Send keyboard input

// Sends text input or a shortcut to the element
driver.FindElement(ByTag("input")).SendKeys("Hello, world!");

// Sends text input or a shortcut to the active window
driver.SendKeys(Shortcut() << keys::Control << "t");

Emulate mobile devices (only Chrome)

chrome::MobileEmulation me;
me.SetdeviceName(chrome::device::Get("Galaxy Note 3"));
WebDriver ff = Start(Chrome().SetMobileEmulation(me));

Execute Javascript

// Simple script, no parameters
driver.Execute("console.log('Hi there!')");

// A script with one parameter
driver.Execute("document.title = arguments[0]", JsArgs() << "Cowabunga!");

// A script with more than one parameter
driver.Execute("document.title = arguments[0] + '-' + arguments[1]",
		JsArgs() << "Beep" << "beep");

// Arrays or containers can also be used as parameters
const char* ss[] = { "Yabba", "dabba", "doo" };
driver.Execute("document.title = arguments[0].join(', ')", JsArgs() << ss);

// Even an Element can be passed to a script
auto element = driver.FindElement(ByTag("input"));
driver.Execute("arguments[0].value = 'That was nuts!'", JsArgs() << element);

Get something from Javascript

// Scalar types
auto title = driver.Eval<std::string>("return document.title")
auto number = driver.Eval<int>("return 123");
auto another_number = driver.Eval<double>("return 123.5");
auto flag = driver.Eval<bool>("return true");

// Containers (all std::back_inserter compatible)
std::vector<std::string> v = driver.Eval<std::vector<std::string>>(
		"return [ 'abc', 'def' ]"
		);

// Elements!
Element document_element = driver.Eval<Element>("return document.documentElement");

Wait implicitly for asynchronous operations

driver.SetImplicitTimeoutMs(5000);

// Should poll the DOM for 5 seconds before throwing an exception.
auto element = driver.FindElement(ByName("async_element"));

Wait explicitly for asynchronous operations

#include <webdriverxx/wait.h>

auto find_element = [&]{ return driver.FindElement(ById("async_element")); };
Element element = WaitForValue(find_element);
#include <webdriverxx/wait.h>

auto element_is_selected = [&]{
	return driver.FindElement(ById("asynchronously_loaded_element")).IsSelected();
	};
WaitUntil(element_is_selected);

Use matchers from Google Mock for waiting

#define WEBDRIVERXX_ENABLE_GMOCK_MATCHERS
#include <webdriverxx/wait_match.h>

driver.Navigate("http://initial_url.host.net");
auto url = [&]{ return driver.GetUrl(); };
using namespace ::testing;
auto final_url = WaitForMatch(url, HasSubstr("some_magic"));

Testing with real browsers

Prerequisites:

Linux

java -jar selenium-server.jar standalone &
./webdriverxx --browser=<firefox|chrome|...>

Windows

java -jar selenium-server.jar standalone
webdriverxx.exe --browser=<firefox|chrome|...>

Advanced topics

Unicode

The library is designed to be encoding-agnostic. It doesn't make any assumptions about encodings. All strings are transferred as is, without modifications.

The WebDriver protocol is based on UTF-8, so all strings passed to the library/received from the library should be/are encoded using UTF-8.

Thread safety

  • Webdriver++ objects are not thread safe. It is not safe to use neither any single object nor different objects obtained from a single WebDriver concurrently without synchronization. On the other side, Webdriver++ objects don't use global variables so it is OK to use different instances of WebDriver in different threads.

  • The CURL library should be explicitly initialized if several WebDrivers are used from multiple threads. Call curl_global_init(CURL_GLOBAL_ALL); from <curl/curl.h> once per process before using this library.

Use common capabilities for all browsers

Capabilities common;
common.SetProxy(DirectConnection());
auto ff = Start(Firefox(common));
auto ie = Start(InternetExplorer(common));
auto gc = Start(Chrome(common));

Use required capabilities

Capabilities required = /* ... */;
auto ff = Start(Firefox(), required);

Use custom URL for connecting to WebDriver

const char* url = "http://localhost:4444/wd/hub/";

auto ff = Start(Firefox(), url);

// or
auto ff = Start(Firefox(), Capabilities() /* required */, url);

Transfer objects between C++ and Javascript

namespace custom {

struct Object {
	std::string string;
	int number;
};

// Conversion functions should be in the same namespace as the object
picojson::value CustomToJson(const Object& value) {
	return JsonObject()
		.Set("string", value.string)
		.Set("number", value.number);
}

void CustomFromJson(const picojson::value& value, Object& result) {
	assert(value.is<picojson::object>());
	result.string = FromJson<std::string>(value.get("string"));
	result.number = FromJson<int>(value.get("number"));
}

} // namespace custom

custom::Object o1 = { "abc", 123 };
driver.Execute("var o1 = arguments[0];", JsArgs() << o1);
custom::Object o1_copy = driver.Eval<custom::Object>("return o1");
custom::Object o2 = driver.Eval<custom::Object>("return { string: 'abc', number: 123 }");

webdriverxx's People

Contributors

germanaizek avatar greeley avatar mecanik avatar no-47 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

webdriverxx's Issues

Problem with Google Test

The problem is here:

TEST(WaitForMatch, CanUseGMockMatchers) {
using namespace ::testing;
ASSERT_EQ(123, WaitForMatch([]{ return 123; }, Eq(123)));
ASSERT_EQ(123, WaitForMatch([]{ return 123; }, 123));
ASSERT_EQ("abc", WaitForMatch([]{ return std::string("abc"); }, "abc"));
ASSERT_EQ("abc", WaitForMatch([]{ return std::string("abc"); }, Eq("abc")));
ASSERT_EQ(123, WaitForMatch([]{ return 123; }, _));
ASSERT_EQ(123, WaitForMatch([]{ return 123; }, An()));
std::vector v(1, 123);
ASSERT_EQ(v, WaitForMatch([&v]{ return v; }, Contains(123)));
ASSERT_EQ(v, WaitForMatch([&v]{ return v; }, Not(Contains(456))));
Duration timeout = 0;
ASSERT_THROW(WaitForMatch([&v]{ return v; }, Not(Contains(123)), timeout), WebDriverException);
}

in the wait_match_test.cpp

Functions An(), Contains() and Not() are not defined.

Do anyone have the idea how to fix this?

Fails to compile on MacOS

dczaretsky commented on Feb 21, 2020

The program fails to compile on MacOS with the errors below. It seems the googletest is not compiled with the flag -std=c++11. Additionally the googletest include and lib directories are not properly set up for the compile paths.

In case someone else is having similar issues, I fixed this issue by updating the GoogleTest in the test/CMakeLists.txt file as follows:

# Google test
externalproject_add(googletest
                PREFIX googletest
                GIT_REPOSITORY https://github.com/google/googletest
                UPDATE_COMMAND ""
                CMAKE_ARGS
                        -DCMAKE_CXX_FLAGS="-std=c++11"
)
externalproject_get_property(googletest source_dir binary_dir)
include_directories("${source_dir}/googletest/include")
include_directories("${source_dir}/googlemock/include")
link_directories("${binary_dir}/lib")
list(APPEND DEPS googletest)
list(APPEND LIBS gtest gmock)
Scanning dependencies of target googletest
[  1%] Creating directories for 'googletest'
[  3%] Performing download step (git clone) for 'googletest'
Cloning into 'googletest'...
Already on 'master'
Your branch is up-to-date with 'origin/master'.
[  5%] No patch step for 'googletest'
[  7%] No update step for 'googletest'
[  9%] Performing configure step for 'googletest'
-- The C compiler identification is AppleClang 11.0.0.11000033
-- The CXX compiler identification is AppleClang 11.0.0.11000033
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found PythonInterp: /usr/bin/python (found version "2.7.16") 
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - found
-- Found Threads: TRUE  
-- Configuring done
-- Generating done
-- Build files have been written to: /build/test/googletest/src/googletest-build
[ 11%] Performing build step for 'googletest'
Scanning dependencies of target gtest
[ 12%] Building CXX object googletest/CMakeFiles/gtest.dir/src/gtest-all.cc.o
In file included from /build/test/googletest/src/googletest/googletest/src/gtest-all.cc:38:
In file included from /build/test/googletest/src/googletest/googletest/include/gtest/gtest.h:62:
In file included from /build/test/googletest/src/googletest/googletest/include/gtest/internal/gtest-internal.h:40:
/build/test/googletest/src/googletest/googletest/include/gtest/internal/gtest-port.h:842:12: error: no member named
      'make_tuple' in namespace 'std'
using std::make_tuple;
      ~~~~~^
/build/test/googletest/src/googletest/googletest/include/gtest/internal/gtest-port.h:843:12: error: no member named 'tuple' in
      namespace 'std'
using std::tuple;
      ~~~~~^
/build/test/googletest/src/googletest/googletest/include/gtest/internal/gtest-port.h:922:3: error: deleted function
      definitions are a C++11 extension [-Werror,-Wc++11-extensions]
  GTEST_DISALLOW_ASSIGN_(RE);
  ^

Reference: durdyev/webdriverxx#8

Error after example execution

after starting the server and running the executable after opening firefox it crashes unexpectedly, reporting this error:

I had these error:
libc++abi: terminating with uncaught exception of type webdriverxx::WebDriverException: HTTP code indicates that request is invalid at line 171, file /Library/webdriverxx/src/include/webdriverxx/detail/resource.h called from ProcessResponse (HTTP code: 405, body: HTTP method not allowed) called from Download (request: GET, command: , resource: http://localhost:4444/wd/hub/session/4d4f5af4-66b4-436f-a251-d605ca6994fc) called from CreateSession zsh: abort ./a.out

compiled with this command:
g++ -I /Library/webdriverxx/src/include main.cpp -std=c++20 -lcurl

Adding CDP support

Hi,

I`m trying to add CDP commands support, but for some reason it fails at the moment.

org.openqa.selenium.UnsupportedCommandException: POST /session/9fa9bcf54a4a09035beee36c1eb1c6b6/goog/cdp/execute

  • Selenium: 4.1.1
  • Chrome: 97.0.4692.71
  • Chrome Driver: 97.0.4692.71

Command code:

session.inl

inline
void Session::ExecuteCdpCommand(const std::string& commandName, const JsonObject& args) const {
	
	resource_->Post("goog/cdp/execute",
		JsonObject()
			.Set("cmd", commandName)
			.Set("params", args)
		);
}

Please advise if you know how to make this work, CDP support would be amazing!

Critical JSON bug

Crazy bug, chromedriver does not accept most json data.
Fix it urgently!

Can't compile the example, server running on 4444

epikoder commented on Jan 11, 2020

[erik@codebase New Folder]$ g++ main.cpp -o run
/usr/bin/ld: /tmp/ccyPYgcD.o: in function webdriverxx::detail::HttpHeaders::~HttpHeaders()': main.cpp:(.text._ZN11webdriverxx6detail11HttpHeadersD2Ev[_ZN11webdriverxx6detail11HttpHeadersD5Ev]+0x17): undefined reference to curl_slist_free_all'
/usr/bin/ld: /tmp/ccyPYgcD.o: in function webdriverxx::detail::HttpHeaders::Add(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)': main.cpp:(.text._ZN11webdriverxx6detail11HttpHeaders3AddERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES9_[_ZN11webdriverxx6detail11HttpHeaders3AddERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES9_]+0x95): undefined reference to curl_slist_append'
/usr/bin/ld: /tmp/ccyPYgcD.o: in function webdriverxx::detail::HttpRequest::Execute()': main.cpp:(.text._ZN11webdriverxx6detail11HttpRequest7ExecuteEv[_ZN11webdriverxx6detail11HttpRequest7ExecuteEv]+0x3a): undefined reference to curl_easy_reset'
/usr/bin/ld: main.cpp:(.text._ZN11webdriverxx6detail11HttpRequest7ExecuteEv[_ZN11webdriverxx6detail11HttpRequest7ExecuteEv]+0x216): undefined reference to curl_easy_perform' /usr/bin/ld: /tmp/ccyPYgcD.o: in function webdriverxx::detail::HttpRequest::GetHttpCode() const':
main.cpp:(.text._ZNK11webdriverxx6detail11HttpRequest11GetHttpCodeEv[_ZNK11webdriverxx6detail11HttpRequest11GetHttpCodeEv]+0x4f): undefined reference to curl_easy_getinfo' /usr/bin/ld: main.cpp:(.text._ZNK11webdriverxx6detail11HttpRequest11GetHttpCodeEv[_ZNK11webdriverxx6detail11HttpRequest11GetHttpCodeEv]+0xf3): undefined reference to curl_easy_strerror'
/usr/bin/ld: /tmp/ccyPYgcD.o: in function webdriverxx::detail::HttpConnection::~HttpConnection()': main.cpp:(.text._ZN11webdriverxx6detail14HttpConnectionD2Ev[_ZN11webdriverxx6detail14HttpConnectionD5Ev]+0x35): undefined reference to curl_easy_cleanup'
/usr/bin/ld: /tmp/ccyPYgcD.o: in function webdriverxx::detail::HttpConnection::InitCurl()': main.cpp:(.text._ZN11webdriverxx6detail14HttpConnection8InitCurlEv[_ZN11webdriverxx6detail14HttpConnection8InitCurlEv]+0x1e): undefined reference to curl_easy_init'
/usr/bin/ld: /tmp/ccyPYgcD.o: in function void webdriverxx::detail::HttpRequest::SetOption<char const*>(CURLoption, char const* const&) const': main.cpp:(.text._ZNK11webdriverxx6detail11HttpRequest9SetOptionIPKcEEv10CURLoptionRKT_[_ZNK11webdriverxx6detail11HttpRequest9SetOptionIPKcEEv10CURLoptionRKT_]+0x57): undefined reference to curl_easy_setopt'
/usr/bin/ld: main.cpp:(.text.ZNK11webdriverxx6detail11HttpRequest9SetOptionIPKcEEv10CURLoptionRKT[ZNK11webdriverxx6detail11HttpRequest9SetOptionIPKcEEv10CURLoptionRKT]+0x12e): undefined reference to curl_easy_strerror' /usr/bin/ld: /tmp/ccyPYgcD.o: in function void webdriverxx::detail::HttpRequest::SetOption<unsigned long ()(void, unsigned long, unsigned long, void*)>(CURLoption, unsigned long (* const&)(void*, unsigned long, unsigned long, void*)) const':
main.cpp:(.text.ZNK11webdriverxx6detail11HttpRequest9SetOptionIPFmPvmmS3_EEEv10CURLoptionRKT[ZNK11webdriverxx6detail11HttpRequest9SetOptionIPFmPvmmS3_EEEv10CURLoptionRKT]+0x57): undefined reference to curl_easy_setopt' /usr/bin/ld: main.cpp:(.text._ZNK11webdriverxx6detail11HttpRequest9SetOptionIPFmPvmmS3_EEEv10CURLoptionRKT_[_ZNK11webdriverxx6detail11HttpRequest9SetOptionIPFmPvmmS3_EEEv10CURLoptionRKT_]+0x12e): undefined reference to curl_easy_strerror'
/usr/bin/ld: /tmp/ccyPYgcD.o: in function void webdriverxx::detail::HttpRequest::SetOption<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*>(CURLoption, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >* const&) const': main.cpp:(.text._ZNK11webdriverxx6detail11HttpRequest9SetOptionIPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEEv10CURLoptionRKT_[_ZNK11webdriverxx6detail11HttpRequest9SetOptionIPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEEv10CURLoptionRKT_]+0x57): undefined reference to curl_easy_setopt'
/usr/bin/ld: main.cpp:(.text.ZNK11webdriverxx6detail11HttpRequest9SetOptionIPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEEv10CURLoptionRKT[ZNK11webdriverxx6detail11HttpRequest9SetOptionIPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEEv10CURLoptionRKT]+0x12e): undefined reference to curl_easy_strerror' /usr/bin/ld: /tmp/ccyPYgcD.o: in function void webdriverxx::detail::HttpRequest::SetOption<char () [256]>(CURLoption, char ( const&) [256]) const':
main.cpp:(.text.ZNK11webdriverxx6detail11HttpRequest9SetOptionIPA256_cEEv10CURLoptionRKT[ZNK11webdriverxx6detail11HttpRequest9SetOptionIPA256_cEEv10CURLoptionRKT]+0x57): undefined reference to curl_easy_setopt' /usr/bin/ld: main.cpp:(.text._ZNK11webdriverxx6detail11HttpRequest9SetOptionIPA256_cEEv10CURLoptionRKT_[_ZNK11webdriverxx6detail11HttpRequest9SetOptionIPA256_cEEv10CURLoptionRKT_]+0x12e): undefined reference to curl_easy_strerror'
/usr/bin/ld: /tmp/ccyPYgcD.o: in function void webdriverxx::detail::HttpRequest::SetOption<curl_slist*>(CURLoption, curl_slist* const&) const': main.cpp:(.text._ZNK11webdriverxx6detail11HttpRequest9SetOptionIP10curl_slistEEv10CURLoptionRKT_[_ZNK11webdriverxx6detail11HttpRequest9SetOptionIP10curl_slistEEv10CURLoptionRKT_]+0x57): undefined reference to curl_easy_setopt'
/usr/bin/ld: main.cpp:(.text.ZNK11webdriverxx6detail11HttpRequest9SetOptionIP10curl_slistEEv10CURLoptionRKT[ZNK11webdriverxx6detail11HttpRequest9SetOptionIP10curl_slistEEv10CURLoptionRKT]+0x12e): undefined reference to curl_easy_strerror' /usr/bin/ld: /tmp/ccyPYgcD.o: in function void webdriverxx::detail::HttpRequest::SetOption<char [7]>(CURLoption, char const (&) [7]) const':
main.cpp:(.text.ZNK11webdriverxx6detail11HttpRequest9SetOptionIA7_cEEv10CURLoptionRKT[ZNK11webdriverxx6detail11HttpRequest9SetOptionIA7_cEEv10CURLoptionRKT]+0x54): undefined reference to curl_easy_setopt' /usr/bin/ld: main.cpp:(.text._ZNK11webdriverxx6detail11HttpRequest9SetOptionIA7_cEEv10CURLoptionRKT_[_ZNK11webdriverxx6detail11HttpRequest9SetOptionIA7_cEEv10CURLoptionRKT_]+0x12b): undefined reference to curl_easy_strerror'
/usr/bin/ld: /tmp/ccyPYgcD.o: in function void webdriverxx::detail::HttpRequest::SetOption<long>(CURLoption, long const&) const': main.cpp:(.text._ZNK11webdriverxx6detail11HttpRequest9SetOptionIlEEv10CURLoptionRKT_[_ZNK11webdriverxx6detail11HttpRequest9SetOptionIlEEv10CURLoptionRKT_]+0x57): undefined reference to curl_easy_setopt'
/usr/bin/ld: main.cpp:(.text.ZNK11webdriverxx6detail11HttpRequest9SetOptionIlEEv10CURLoptionRKT[ZNK11webdriverxx6detail11HttpRequest9SetOptionIlEEv10CURLoptionRKT]+0x12e): undefined reference to curl_easy_strerror' /usr/bin/ld: /tmp/ccyPYgcD.o: in function void webdriverxx::detail::HttpRequest::SetOption(CURLoption, unsigned long const&) const':
main.cpp:(.text.ZNK11webdriverxx6detail11HttpRequest9SetOptionImEEv10CURLoptionRKT[ZNK11webdriverxx6detail11HttpRequest9SetOptionImEEv10CURLoptionRKT]+0x57): undefined reference to curl_easy_setopt' /usr/bin/ld: main.cpp:(.text._ZNK11webdriverxx6detail11HttpRequest9SetOptionImEEv10CURLoptionRKT_[_ZNK11webdriverxx6detail11HttpRequest9SetOptionImEEv10CURLoptionRKT_]+0x12e): undefined reference to curl_easy_strerror'
/usr/bin/ld: /tmp/ccyPYgcD.o: in function void webdriverxx::detail::HttpRequest::SetOption<unsigned long (void*, unsigned long, unsigned long, void*)>(CURLoption, unsigned long ( const&)(void*, unsigned long, unsigned long, void*)) const': main.cpp:(.text._ZNK11webdriverxx6detail11HttpRequest9SetOptionIFmPvmmS3_EEEv10CURLoptionRKT_[_ZNK11webdriverxx6detail11HttpRequest9SetOptionIFmPvmmS3_EEEv10CURLoptionRKT_]+0x54): undefined reference to curl_easy_setopt'
/usr/bin/ld: main.cpp:(.text.ZNK11webdriverxx6detail11HttpRequest9SetOptionIFmPvmmS3_EEEv10CURLoptionRKT[ZNK11webdriverxx6detail11HttpRequest9SetOptionIFmPvmmS3_EEEv10CURLoptionRKT]+0x12b): undefined reference to curl_easy_strerror' /usr/bin/ld: /tmp/ccyPYgcD.o: in function void webdriverxx::detail::HttpRequest::SetOptionwebdriverxx::detail::HttpPostRequest*(CURLoption, webdriverxx::detail::HttpPostRequest* const&) const':
main.cpp:(.text.ZNK11webdriverxx6detail11HttpRequest9SetOptionIPNS0_15HttpPostRequestEEEv10CURLoptionRKT[ZNK11webdriverxx6detail11HttpRequest9SetOptionIPNS0_15HttpPostRequestEEEv10CURLoptionRKT]+0x57): undefined reference to curl_easy_setopt' /usr/bin/ld: main.cpp:(.text._ZNK11webdriverxx6detail11HttpRequest9SetOptionIPNS0_15HttpPostRequestEEEv10CURLoptionRKT_[_ZNK11webdriverxx6detail11HttpRequest9SetOptionIPNS0_15HttpPostRequestEEEv10CURLoptionRKT_]+0x12e): undefined reference to curl_easy_strerror'

Reference: durdyev/webdriverxx#7 (comment)

Fork for Selenium server cutting telemetry and part remote tools

Now Selenium server is a huge set of tools for automatic testing of web projects. I understand that the functionality of the server will be limited after cutting out many functions, but some people do not need remote modules or the use of OpenTelemetry for logging.

Example in Selenium Server:

https://github.com/SeleniumHQ/selenium/blob/096ec415e491cda9db51586ab09de54fadbdc428/java/server/src/org/openqa/selenium/grid/log/LoggingOptions.java#L83-L94

The advantage of fork will be in speed compared to the usual Selenium server.

Fork will be called Waterium, which means the transparency of what happens on the server.

gc.GetCookies();

Hi @GermanAizek , me again, this is the last time I promise hahahah.

This is not a issue at all. I have to get the page cookies and then "convert" it to a string to send in a Link (using curl) to an API.

How can i do that?

auto cookies = gc.GetCookies();

URL Format:

Format: KEY:Value, separator: semicolon, example: KEY1:Value1;KEY2:Value2;

btw if you have Discord, please send to me. I really enjoyed this project but has a lot of things which i got confused hahahah. also the program is finished, but the API requests the page's cookies, so...

"driver.version: unknown" and "entry 0 of 'firstMatch' is invalid"

Hello,

There are exceptions while running the sample code with selenium-server-4.8.1 and selenium-server-4.0.0..  While there is no exceptions from https://github.com/durdyev/webdriverxx . 
   java -jar selenium-server-4.8.1.jar standalone -p 4444 &
  java -jar selenium-server-4.0.0.jar standalone -p 4444 &

The selenium-server is attached.

Many thanks!

-Scott

============
Code:

#include <webdriverxx.h>
#include <webdriverxx/browsers/chrome.h>
using namespace webdriverxx;

int main(int argc, char** argv) {

WebDriver chrome = Start(Chrome());
chrome
	.Navigate("https://www.google.com")
	.FindElement(ByCss("input[name=q]"))
	.SendKeys("Hello, world!")
	.Submit();

std::cout << " Please input any key to exit ..." << std::endl;
std::cin.get();
return 0;

}

================
webdriverxx\src\include\webdriverxx\client.inl
Line 56:
const auto response = resource_->Post("session",
//JsonObject()
// //.Set("desiredCapabilities", firstMatch) // don't set this, for some reason it will fuck up.
// .Set("capabilities", firstMatch)
// .Set("requiredCapabilities", firstMatch)
//);
JsonObject()
.Set("desiredCapabilities", static_castpicojson::value(desired))
.Set("requiredCapabilities", static_castpicojson::value(required))
);

client issue:

Unhandled exception at 0x00007FF8611DFE7C in webdriverxx_test.exe: Microsoft C++ exception: webdriverxx::WebDriverException at memory location 0x000000D8FBBBF060.

selenium-server_webdriverxx_log.txt

Proxy still not working (Windows)

I have no words to this

WebDriver gc = Start(Chrome().SetProxy(
       SocksProxy("127.0.0.25:9000")));

image

Windows 10
Selenium Server 4.0.0 beta 2

Edit: same with firefox

Arguments/Options not passed on to Selenium 4.x

Hi, thanks for updating this old script to latest selenium. There are a few issues though, like some arguments and options not being passed on. Tested with Chrome 97.0.4692.0.

Args:

--window-size=1280,1024

Selenium says: "???" = not even there

Capabilities:

common.SetAcceptSslCerts(true);

Selenium says: "acceptInsecureCerts:false"

There are probably more I just need to test.

Runtime exception

Run WebDriver browser = Start(Edge()); will throw an exception, "JSON parser error (syntax error at line 1 near: ) at line 179, file D:\迅雷下载\Develope\webdriverxx\src\include\webdriverxx\detail\resource.h called from webdriverxx::detail::Resource::ProcessResponse (HTTP code: 503, body: ) called from webdriverxx::detail::Resource::Upload (request: POST, command: session, resource: http://localhost:4444/wd/hub/, data: {"capabilities":{"firstMatch":[{"browserName":"MicrosoftEdge","browserVersion":"","platformName":"ANY"}]},"requiredCapabilities":{"firstMatch":[{"browserName":"MicrosoftEdge","browserVersion":"","platformName":"ANY"}]}}) called from webdriverxx::Client::CreateSession".
Selenium and EdgeWebdriver seem to receive nothing.

Proxy not working

Sup dude, me again.

I can't use proxy in chrome.

Code:

WebDriver gc = Start(Chrome().SetProxy(
       SocksProxy("186.179.7.98:8175")
   ));

Result:

image

Click() prob not returning in mobile mode

Hi, me again :)

Yes, AutoIt was a good idea, BUT...... when chrome is in mobile mode, the click function freezes my program. Let me explain what i'm trying to do:

gc.FindElement(ByXPath("/html/body/div[1]/section/main/div/header/div/div/div/button")).Click();

and it works perfectly in normal mode, it clicks and the program still running as normal, but when i try to do the exact same thing in chrome mobile mode, the click WORKS, but the program stops, it's not crashing or stop responding, it's just still waiting the function return successful like an infinity Sleep.

What should i do?

Exception handler

Mecanik commented on May 28, 2020

First thing, amazing project. Just amazing. You saved me a TON of time.

Is there a way to catch/handle these sort of exceptions ? https://prnt.sc/spbhlg

This happens when I try to use proxies, and the weird thing is that eventually the browser loads.

Reference: durdyev/webdriverxx#10

The compiler reports some errors

there are a lot of bugs need to be fix....
1、uint64_t type need to define CustomToJson function or compiler doesn't know how to convert the type
image
image
2、Some functions, which are defined in session.inl need to be declared in header files(session.h).
image
3、identifier 'id' is not defined in session.inl. i just delete them:
image
image
4、SetMobileEmulation is not defined is emulatechrome_test.cpp. I changed like this:
image
5、Firefox obj do not define SetLoggingPrefs. i see that you commented these code, so delete these code in browsers_test.cpp:
image

Can we perform this code?

Hi, I want to perform something like this;

        driver.execute_cdp_cmd(
            'Network.setCookie',
            {
                'domain': 'chat.openai.com',
                'path': '/',
                'name': '__Secure-next-auth.session-token',
                'value': self.__session_token,
                'httpOnly': True,
                'secure': True,
            },
        )

Can we do it using this driver??

Session close during a start.

Hi evrybody,

An exception is thrown during a start for chrome.

The session is created, chrome opened and closed instantly.
And finaly an exception is thrown during the execution of WEBDRIVERXX_FUNCTION_CONTEXT_END() on client.inl.

Here is my code :

Capabilities common;
common.SetPlatform(platform::Windows);
Chrome ch(common);
ChromeOptions options;
options.SetArgs({ "start-maximized", "user-data-dir=H:/Programmation/chrome"}); // optional
ch.SetChromeOptions(options);
WebDriver browser = Start(ch);
browser.Navigate("https://duckduckgo.org");
Element elem = browser.FindElement(ByCss("input[name=q]"));
elem.SendKeys("sha512 helloworld");
elem.Submit();
getchar();
return 0;
It do not go further than
WebDriver browser = Start(ch);

And here is the log on selenium :
C:\Users\Flordjam\Downloads>java -jar selenium-server-4.8.1.jar standalone
16:30:10.654 INFO [LoggingOptions.configureLogEncoding] - Using the system default encoding
16:30:10.658 INFO [OpenTelemetryTracer.createTracer] - Using OpenTelemetry for tracing
16:30:11.445 INFO [NodeOptions.getSessionFactories] - Detected 12 available processors
16:30:13.025 INFO [NodeOptions.discoverDrivers] - Discovered 4 driver(s)
16:30:13.040 INFO [NodeOptions.report] - Adding Chrome for {"browserName": "chrome"} 12 times
16:30:13.041 INFO [NodeOptions.report] - Adding Internet Explorer for {"browserName": "internet explorer"} 1 times
16:30:13.041 INFO [NodeOptions.report] - Adding Firefox for {"browserName": "firefox"} 12 times
16:30:13.042 INFO [NodeOptions.report] - Adding Edge for {"browserName": "MicrosoftEdge"} 12 times
16:30:13.072 INFO [Node.] - Binding additional locator mechanisms: relative
16:30:13.085 INFO [GridModel.setAvailability] - Switching Node 1ad5efdb-48fa-45c5-8579-75d63675210d (uri: http://172.31.128.1:4444) from DOWN to UP
16:30:13.085 INFO [LocalDistributor.add] - Added node 1ad5efdb-48fa-45c5-8579-75d63675210d at http://172.31.128.1:4444. Health check every 120s
16:30:13.306 INFO [Standalone.execute] - Started Selenium Standalone 4.8.1 (revision 8ebccac989): http://172.31.128.1:4444
16:30:22.442 INFO [LocalDistributor.newSession] - Session request received by the Distributor:
[Capabilities {browserName: chrome, goog:chromeOptions: {args: [start-maximized, user-data-dir=H:/Programmation]}, platformName: ANY}]
Starting ChromeDriver 110.0.5481.77 (65ed616c6e8ee3fe0ad64fe83796c020644d42af-refs/branch-heads/5481@{#839}) on port 25030
Only local connections are allowed.
Please see https://chromedriver.chromium.org/security-considerations for suggestions on keeping ChromeDriver safe.
ChromeDriver was started successfully.
[1678116623.276][WARNING]: virtual void DevToolsClientImpl::AddListener(DevToolsEventListener *) subscribing a listener to the already connected DevToolsClient. Connection notification will not arrive.
16:30:23.329 INFO [LocalNode.newSession] - Session created by the Node. Id: a22f5918210704c176298e010e068110, Caps: Capabilities {acceptInsecureCerts: false, browserName: chrome, browserVersion: 110.0.5481.178, chrome: {chromedriverVersion: 110.0.5481.77 (65ed616c6e8e..., userDataDir: H:/Programmation}, goog:chromeOptions: {debuggerAddress: localhost:63740}, networkConnectionEnabled: false, pageLoadStrategy: normal, platformName: ANY, proxy: Proxy(), se:cdp: http://localhost:63740, se:cdpVersion: 110.0.5481.178, setWindowRect: true, strictFileInteractability: false, timeouts: {implicit: 0, pageLoad: 300000, script: 30000}, unhandledPromptBehavior: dismiss and notify, webauthn:extension:credBlob: true, webauthn:extension:largeBlob: true, webauthn:virtualAuthenticators: true}
16:30:23.339 INFO [LocalDistributor.newSession] - Session created by the Distributor. Id: a22f5918210704c176298e010e068110
Caps: Capabilities {acceptInsecureCerts: false, browserName: chrome, browserVersion: 110.0.5481.178, chrome: {chromedriverVersion: 110.0.5481.77 (65ed616c6e8e..., userDataDir: H:/Programmation}, goog:chromeOptions: {debuggerAddress: localhost:63740}, networkConnectionEnabled: false, pageLoadStrategy: normal, platformName: ANY, proxy: Proxy(), se:bidiEnabled: false, se:cdp: ws://172.31.128.1:4444/sess..., se:cdpVersion: 110.0.5481.178, setWindowRect: true, strictFileInteractability: false, timeouts: {implicit: 0, pageLoad: 300000, script: 30000}, unhandledPromptBehavior: dismiss and notify, webauthn:extension:credBlob: true, webauthn:extension:largeBlob: true, webauthn:virtualAuthenticators: true}
16:30:23.360 WARN [SeleniumSpanExporter$1.lambda$export$3] - {"traceId": "da3e670f365c16447e684450a7a36211","eventTime": 1678116623359532301,"eventName": "HTTP request execution complete","attributes": {"http.flavor": 1,"http.handler_class": "org.openqa.selenium.remote.http.Route$PredicatedRoute","http.host": "localhost:4444","http.method": "GET","http.scheme": "HTTP","http.status_code": 404,"http.target": "\u002fsession\u002fa22f5918210704c176298e010e068110"}}

16:30:24.806 INFO [LocalSessionMap.lambda$new$0] - Deleted session from local Session Map, Id: a22f5918210704c176298e010e068110
16:30:24.807 INFO [GridModel.release] - Releasing slot for session id a22f5918210704c176298e010e068110
16:30:24.809 INFO [SessionSlot.stop] - Stopping session a22f5918210704c176298e010e068110

I'am using visual studio code 2022 on windows 10. ChromDriver and chrome version 110. selenium-server-4.8.1.jar.

I spend a lot of time trying to understand the problem without result. If you can help me please ?

Cant start Chrome Windows 10.

Hi,
Thank you for this great library it works perfect for FireFox, but I can't start Chrome browser not sure what I do wrong, or what I am missing to make it work, this is the issue after I run the chrome and the app crash, this log from server.

Starting ChromeDriver 96.0.4664.45 (76e4c1bb2ab4671b8beba3444e61c0f17584b2fc-refs/branch-heads/4664@{#947}) on port 64006
Only local connections are allowed.
Please see https://chromedriver.chromium.org/security-considerations for suggestions on keeping ChromeDriver safe.
ChromeDriver was started successfully.
17:23:28.050 WARN [SeleniumSpanExporter$1.lambda$export$0] - {"traceId": "0da57dbfd02a5922a920f400f57f0715","eventTime": 1638113007529897201,"eventName": "exception","attributes": {"driver.url": "http:\u002f\u002flocalhost:64006","exception.message": "Error while creating session with the driver service. Stopping driver service: Could not start a new session. Response code 400. Message: invalid argument: entry 0 of 'firstMatch' is invalid\nfrom invalid argument: cannot parse capability: browserVersion\nfrom invalid argument: cannot be empty\nBuild info: version: '4.1.0', revision: '87802e897b'\nSystem info: host: 'DESKTOP-8QSC5AU', ip: '192.168.1.7', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_311'\nDriver info: driver.version: unknown","exception.stacktrace": "org.openqa.selenium.SessionNotCreatedException: Could not start a new session. Response code 400. Message: invalid argument: entry 0 of 'firstMatch' is invalid\nfrom invalid argument: cannot parse capability: browserVersion\nfrom invalid argument: cannot be empty\nBuild info: version: '4.1.0', revision: '87802e897b'\nSystem info: host: 'DESKTOP-8QSC5AU', ip: '192.168.1.7', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_311'\nDriver info: driver.version: unknown\r\n\tat org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:126)\r\n\tat org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:84)\r\n\tat org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:62)\r\n\tat org.openqa.selenium.grid.node.config.DriverServiceSessionFactory.apply(DriverServiceSessionFactory.java:131)\r\n\tat org.openqa.selenium.grid.node.config.DriverServiceSessionFactory.apply(DriverServiceSessionFactory.java:65)\r\n\tat org.openqa.selenium.grid.node.local.SessionSlot.apply(SessionSlot.java:143)\r\n\tat org.openqa.selenium.grid.node.local.LocalNode.newSession(LocalNode.java:314)\r\n\tat org.openqa.selenium.grid.distributor.local.LocalDistributor.startSession(LocalDistributor.java:513)\r\n\tat org.openqa.selenium.grid.distributor.local.LocalDistributor.newSession(LocalDistributor.java:440)\r\n\tat org.openqa.selenium.grid.distributor.local.LocalDistributor$NewSessionRunnable.handleNewSessionRequest(LocalDistributor.java:648)\r\n\tat org.openqa.selenium.grid.distributor.local.LocalDistributor$NewSessionRunnable.lambda$run$1(LocalDistributor.java:612)\r\n\tat java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)\r\n\tat java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)\r\n\tat java.lang.Thread.run(Unknown Source)\r\n","exception.type": "org.openqa.selenium.SessionNotCreatedException","logger": "org.openqa.selenium.grid.node.config.DriverServiceSessionFactory","session.capabilities": "{\"proxy\": {\"proxyType\": \"DIRECT\"},\"browserVersion\": \"\",\"browserName\": \"chrome\",\"platformName\": \"ANY\"}\n"}}

17:23:28.055 WARN [SeleniumSpanExporter$1.lambda$export$0] - {"traceId": "0da57dbfd02a5922a920f400f57f0715","eventTime": 1638113008055032800,"eventName": "HTTP request execution complete","attributes": {"http.flavor": 1,"http.handler_class": "org.openqa.selenium.grid.sessionqueue.local.LocalNewSessionQueue","http.host": "localhost:4444","http.method": "POST","http.request_content_length": "146","http.scheme": "HTTP","http.status_code": 500,"http.target": "\u002fsession"}}

what I tried is to add this line

    common.SetProxy(DirectConnection());
    //WebDriver driver = Start(Firefox(common), "http://localhost:1234");
    common.SetVersion("96");
    WebDriver driver = Start(Chrome(common), "http://localhost:4444");

but also not working, so any idea what this happen, and last thing, do you consider adding it on Conan.io package manager? it will be very cool, so far I connect CURL and gTest using Conan and use the headers directly, so you can easily get the rest of the packages needed on Conan link them.

Thank you in advance.

google test cmake build failed

According to this issue: google/googletest#3663
the googletest git dosen't have 'master' branch anymore...So we need to change the CMakeLists.txt file at webdriverxx\src\test:
cmake_param
change the tag to 'main'...and It compiles fine....

Specifying 'socksProxy' requires an integer for 'socksVersion'

Hello! I see (and hope) you plan to maintain this. I've create an issue on another fork but.. that guy doesn't care so there is no point to insist there.

I've take your fork and I see you have the same issue with the socks proxy, could you please add the following:

struct SocksProxy : ManualProxy { // copyable
	explicit SocksProxy(const std::string& address) { SetProxyAddress(address); }

	WEBDRIVERXX_PROPERTIES_BEGIN(SocksProxy)
	WEBDRIVERXX_PROPERTY(ProxyAddress, "socksProxy", std::string)
	WEBDRIVERXX_PROPERTY(Username, "socksUsername", std::string)
	WEBDRIVERXX_PROPERTY(Password, "socksPassword", std::string)
	**WEBDRIVERXX_PROPERTY(ProxyVersion, "socksVersion", int)**
	WEBDRIVERXX_PROPERTIES_END()
};

Then we can use:

SocksProxy("").SetProxyVersion(5)

This problem appears with chrome driver.

org.openqa.selenium.InvalidArgumentException: invalid argument: entry 0 of 'firstMatch' is invalid
from invalid argument: cannot parse capability: proxy
from invalid argument: Specifying 'socksProxy' requires an integer for 'socksVersion'
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:25:53'

However, afterwards I get the same crash.... https://prnt.sc/spe5bm

Could you give a hand ?

Thanks

Google Test problem?

sherifi commented on Jul 24, 2020

The problem is here:

TEST(WaitForMatch, CanUseGMockMatchers) {
using namespace ::testing;
ASSERT_EQ(123, WaitForMatch([]{ return 123; }, Eq(123)));
ASSERT_EQ(123, WaitForMatch([]{ return 123; }, 123));
ASSERT_EQ("abc", WaitForMatch([]{ return std::string("abc"); }, "abc"));
ASSERT_EQ("abc", WaitForMatch([]{ return std::string("abc"); }, Eq("abc")));
ASSERT_EQ(123, WaitForMatch([]{ return 123; }, _));
ASSERT_EQ(123, WaitForMatch([]{ return 123; }, An()));
std::vector v(1, 123);
ASSERT_EQ(v, WaitForMatch([&v]{ return v; }, Contains(123)));
ASSERT_EQ(v, WaitForMatch([&v]{ return v; }, Not(Contains(456))));
Duration timeout = 0;
ASSERT_THROW(WaitForMatch([&v]{ return v; }, Not(Contains(123)), timeout), WebDriverException);
}

in the wait_match_test.cpp

Functions An(), Contains() and Not() are not defined.

Do anyone have the idea how to fix this?

Reference: durdyev/webdriverxx#11

HTTP code indicates that request is invalid at line 168

I tried this program on Ubuntu 22.04:

#include "webdriverxx.h"

using namespace webdriverxx;

int main()
{
  FirefoxOptions opts;
  WebDriver browser = Start(Firefox());
  browser.Navigate("https://duckduckgo.org");
  Element elem = browser.FindElement(ByCss("input[name=q]"));
  elem.SendKeys("sha512 helloworld");
  elem.Submit();
  getchar();

  return 0;
}

I get the following output:

terminate called after throwing an instance of 'webdriverxx::WebDriverException'
  what():  HTTP code indicates that request is invalid at line 168, file include/webdriverxx/detail/resource.h called from ProcessResponse (HTTP code: 405, body: HTTP method not allowed) called from Download (request: GET, command: , resource: http://localhost:4444/session/28380e5c-dcb6-46cc-b7f1-5a8454491694) called from CreateSession

Is it intended that this error is thrown? I guess not. Does this happen only in my system?

I see Firefox popping up and disappearing again - I assume that is the default behavior?

What the selenium server shows:

java -jar selenium-server-4.12.1.jar standalone
21:37:14.954 INFO [LoggingOptions.configureLogEncoding] - Using the system default encoding
21:37:14.957 INFO [OpenTelemetryTracer.createTracer] - Using OpenTelemetry for tracing
21:37:15.321 INFO [NodeOptions.getSessionFactories] - Detected 24 available processors
21:37:15.321 INFO [NodeOptions.discoverDrivers] - Looking for existing drivers on the PATH.
21:37:15.321 INFO [NodeOptions.discoverDrivers] - Add '--selenium-manager true' to the startup command to setup drivers automatically.
21:37:15.420 WARN [SeleniumManager.lambda$runCommand$1] - Exception managing chrome: Unable to discover proper chromedriver version in offline mode
21:37:15.472 WARN [SeleniumManager.lambda$runCommand$1] - edge cannot be downloaded
21:37:15.790 INFO [NodeOptions.report] - Adding Chrome for {"browserName": "chrome","goog:chromeOptions": {"args": ["--remote-allow-origins=*"]},"platformName": "linux"} 24 times
21:37:15.791 INFO [NodeOptions.report] - Adding Firefox for {"browserName": "firefox","platformName": "linux"} 24 times
21:37:15.845 INFO [Node.] - Binding additional locator mechanisms: relative
21:37:15.855 INFO [GridModel.setAvailability] - Switching Node c411b288-5889-4da4-bb80-45206671dbfb (uri: http://192.168.49.1:4444) from DOWN to UP
21:37:15.855 INFO [LocalDistributor.add] - Added node c411b288-5889-4da4-bb80-45206671dbfb at http://192.168.49.1:4444. Health check every 120s
21:37:15.959 INFO [Standalone.execute] - Started Selenium Standalone 4.12.1 (revision 8e34639b11): http://192.168.49.1:4444
21:37:19.457 INFO [LocalDistributor.newSession] - Session request received by the Distributor:
[Capabilities {acceptInsecureCerts: true, browserName: firefox, moz:debuggerAddress: true}]
21:37:21.694 INFO [LocalNode.newSession] - Session created by the Node. Id: 28380e5c-dcb6-46cc-b7f1-5a8454491694, Caps: Capabilities {acceptInsecureCerts: true, browserName: firefox, browserVersion: 117.0, moz:accessibilityChecks: false, moz:buildID: 20230824214342, moz:debuggerAddress: 127.0.0.1:13030, moz:geckodriverVersion: 0.33.0, moz:headless: false, moz:platformVersion: 6.2.0-32-generic, moz:processID: 23519, moz:profile: /tmp/rust_mozprofileMivsqe, moz:shutdownTimeout: 60000, moz:webdriverClick: true, moz:windowless: false, pageLoadStrategy: normal, platformName: linux, proxy: Proxy(), se:bidiEnabled: false, se:cdp: ws://192.168.49.1:4444/sess..., se:cdpVersion: 85.0, setWindowRect: true, strictFileInteractability: false, timeouts: {implicit: 0, pageLoad: 300000, script: 30000}, unhandledPromptBehavior: dismiss and notify}
21:37:21.698 INFO [LocalDistributor.newSession] - Session created by the Distributor. Id: 28380e5c-dcb6-46cc-b7f1-5a8454491694
Caps: Capabilities {acceptInsecureCerts: true, browserName: firefox, browserVersion: 117.0, moz:accessibilityChecks: false, moz:buildID: 20230824214342, moz:debuggerAddress: 127.0.0.1:13030, moz:geckodriverVersion: 0.33.0, moz:headless: false, moz:platformVersion: 6.2.0-32-generic, moz:processID: 23519, moz:profile: /tmp/rust_mozprofileMivsqe, moz:shutdownTimeout: 60000, moz:webdriverClick: true, moz:windowless: false, pageLoadStrategy: normal, platformName: linux, proxy: Proxy(), se:bidiEnabled: false, se:cdp: ws://192.168.49.1:4444/sess..., se:cdpVersion: 85.0, setWindowRect: true, strictFileInteractability: false, timeouts: {implicit: 0, pageLoad: 300000, script: 30000}, unhandledPromptBehavior: dismiss and notify}
21:37:21.715 WARN [SeleniumSpanExporter$1.lambda$export$3] - {"traceId": "971a92a70dc62201bfa990b1df3846e3","eventTime": 1694201841711764949,"eventName": "HTTP request execution complete","attributes": {"http.flavor": 1,"http.handler_class": "org.openqa.selenium.remote.http.Route$PredicatedRoute","http.host": "localhost:4444","http.method": "GET","http.scheme": "HTTP","http.status_code": 405,"http.target": "\u002fsession\u002f28380e5c-dcb6-46cc-b7f1-5a8454491694"}}

21:37:23.563 INFO [LocalSessionMap.lambda$new$0] - Deleted session from local Session Map, Id: 28380e5c-dcb6-46cc-b7f1-5a8454491694
21:37:23.564 INFO [GridModel.release] - Releasing slot for session id 28380e5c-dcb6-46cc-b7f1-5a8454491694
21:37:23.565 INFO [SessionSlot.stop] - Stopping session 28380e5c-dcb6-46cc-b7f1-5a8454491694

Can't find element

Chrome/program crashing when i try to FindElement..

Element email = gc.FindElement(ByName("emailOrPhone")); 

Edit: same with firefox

Can't open chrome as mobile

I've already tried using SetMobileEmulation and changing setplatform to android but nothing works. SetEmulation nothing happens (idk if i did something wrong) and SetPlataform Android web driver doesn't open.
Idk if it's a problem or if i'm just dumb enoght to don't realize how to use this version of selenium hahah.

Any ideas?

Build fails on Linux

I've been trying to do a clean compile on Debian (WSL), but it failed.

  • I have all dependencies installed

Steps to reproduce

  1. Checkout the repository: git clone https://github.com/GermanAizek/webdriverxx.git
  2. mkdir build && cd build
  3. cmake ../src
  4. make, results in an error: https://pastebin.com/CVneiQWG

System details

  • OS: Debian 9 (WSL)
  • Compiler: gcc 6.3.0
  • Cmake 3.7.2
  • Make 4.1

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.