gpt-4-0314· openai
Suzhen/CodeChat
<!doctype html> <html lang="en"> <head> <title>TradeUpSpy - Profit from CSGO trade ups.…
- User
get the string value from
anyway but selenium
- Assistant
To get the string value from the given HTML element without using Selenium, you can use BeautifulSoup, a Python library for parsing HTML and XML documents. Here's an example:
pythonfrom bs4 import BeautifulSoup html = ''' <!doctype html> <html lang="en"> ... ... <p _ngcontent-serverapp-c4="" class="p_counter" id="counter_free">01d:19h:23m</p> ... ... </html> ''' # Parse the HTML content with BeautifulSoup soup = BeautifulSoup(html, 'html.parser') # Find the target element by its ID element = soup.find(id="counter_free") # Get the string value from the element value = element.string if element else None print('Value:', value)Output:
codeValue: 01d:19h:23m