Skip to content

Bug: Missing Argument in get_element_attribute Method in get_attribute #3415

@Akaliix

Description

@Akaliix

Bug: Missing Argument in get_element_attribute Method in get_attributeFile: fixtures/base_case.py

Description

The get_attribute method contains an error in the following code snippet:

if self.__is_cdp_swap_needed():  
    return self.cdp.get_element_attribute(selector)

The get_element_attribute method from CDPMethods is missing a required positional argument: 'attribute'. This results in the following error:

TypeError: CDPMethods.get_element_attribute() missing 1 required positional argument: 'attribute'

Expected Behavior

The method should pass the attribute argument to get_element_attribute to retrieve the correct attribute value.

Current Behavior

The attribute argument is not being passed, leading to a TypeError.

Steps to Reproduce

  1. Use the following test setup:
with SB(uc=True, incognito=True, test=True, locale_code="en") as sb:  
    sb.activate_cdp_mode("about:blank")  
    sb.uc_open_with_reconnect("https://seleniumbase.io/apps/turnstile", 8)  
    response_value = sb.get_attribute('input[name="cf-turnstile-response"]', 'value')
  1. Observe the TypeError when the method is invoked.

Proposed Fix

Update the code to correctly pass the attribute argument:

if self.__is_cdp_swap_needed():  
    return self.cdp.get_element_attribute(selector, attribute)

Metadata

Metadata

Assignees

Labels

UC Mode / CDP ModeUndetected Chromedriver Mode / CDP ModebugUh oh... Something needs to be fixedworkaround existsYou can reach your destination if you do this...

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions