Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError in get_open_tabs_info: Port number concatenation error for chrome/06fe7178-4491-4589-810f-2e2bc9502122.json #130

Closed
Timothyxxx opened this issue Feb 10, 2025 · 0 comments

Comments

@Timothyxxx
Copy link
Member

Description:
Bug Description
A TypeError occurs in get_open_tabs_info function when constructing the server URL. The error message states: can only concatenate str (not "int") to str, which happens when trying to concatenate the integer port number directly with strings.

Location
File: desktop_env/evaluators/getters/chrome.py, line ~531

Current Code

requests.post("http://" + host + ":" + server_port + "/setup" + "/launch", headers=headers, data=payload)

Proposed Fix
Convert the port number to string or use f-string:

requests.post(f"http://{host}:{server_port}/setup/launch", headers=headers, data=payload)

Additional Notes

  • This issue occurs because server_port is an integer while string concatenation requires all operands to be strings
  • The fix ensures proper type handling when constructing the URL string
  • Using f-strings also makes the code more readable and less prone to such concatenation errors

Labels: bug, easy fix

Timothyxxx added a commit that referenced this issue Feb 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant