SeleniumHQ / selenium

A browser automation framework and ecosystem.
https://selenium.dev
Apache License 2.0
30.52k stars 8.15k forks source link

Gets the element value null in headless mode #8602

Closed vvanglro closed 4 years ago

vvanglro commented 4 years ago

Null when I use headless mode to get the td value in the third tr in the tbody,No headless mode is normal The page element structure of a web page is the three tr groups in the tBody tag

Part of the code That I wrote:
a=WebDriverWait(driver,20).until(EC.presence_of_element_located((By.XPATH,'//a[text()="music"]//..//..//td[contains(@class,"current")]'))).text b = WebDriverWait(driver, 20).until(EC.presence_of_element_located((By.XPATH, '//a[text()="live"]//..//..//td[contains(@class,"current")]'))).text c = WebDriverWait(driver, 20).until(EC.presence_of_element_located((By.XPATH, '//a[text()="person"]//..//..//td[contains(@class,"current")]'))).text print(a) print(b) print(c)

A and B can get values, c can't,I tried to increase the waiting time, but it didn't work,The third td on the page is valuable I got it right when I removed the headless mode

ghost commented 4 years ago

👋 Hi there! Thank you for creating this issue.

I am the Selenium Assistant Bot 🤖, I triage issues in this repository. If I can't do it, I label it to help maintainers identify issues that need triaging.

I am an Open Source project 🙌, post bugs or ideas here!

ghost commented 4 years ago

❗️ It seems this issue is not using any of the supported templates

💡 Supported issue types are (they start with):

Issue templates help this project to stay in shape, please use them and fill them out completely. By doing that you are helping the project because the community and maintainers can provide prompt feedback, and potentially solve the issue.

If you are asking a question, a better way to address this is:

If you think this is incorrect, please feel free to open a new issue.

Thank you for your contributions.